Skip to content

Conversation

@RobertLucian
Copy link
Member

@RobertLucian RobertLucian commented Jun 18, 2020

When a tf.Session object is used in the predict method of a PythonPredictor object that had its session initialized in the constructor, due to using it in a separate thread, the following error is returned:

TypeError: Cannot interpret feed_dict key as Tensor: Tensor Tensor("Placeholder:0", shape=(1, ?), dtype=int32) is not an element of this graph.

To avoid this, calling the with self.sess.graph.as_default() context manager solves the issue by bringing the graph in the current context.

Thank you @danielricks for reporting this!


checklist:

  • run make test and make lint
  • update docs and add any new files to summary.md (view in gitbook after merging)

@RobertLucian RobertLucian added the docs Improvements or additions to documentation label Jun 18, 2020
@RobertLucian RobertLucian requested a review from deliahu June 18, 2020 22:53
@RobertLucian RobertLucian merged commit 54d3d26 into master Jun 25, 2020
@RobertLucian RobertLucian deleted the docs/tf-session-multithread branch June 25, 2020 19:42
deliahu added a commit that referenced this pull request Jun 26, 2020
Co-authored-by: David Eliahu <deliahu@users.noreply.github.com>
(cherry picked from commit 54d3d26)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants