diff options
author | 2017-11-29 11:27:08 -0800 | |
---|---|---|
committer | 2017-11-29 11:30:33 -0800 | |
commit | 71f22bbab05e25c5f026c4343664091cc117b5ab (patch) | |
tree | d1f8c5ac273f632a51f709cfa879294adeab2c0f /tensorflow/contrib/copy_graph | |
parent | 78a4873cfa4562cf071492636f03e13fcb188bd8 (diff) |
(Temporarily) call Graph._add_op outside of Operation.__init__ again.
This change partially undoes my previous commit
(https://github.com/tensorflow/tensorflow/commit/f4c18a0eb05e21bae397c9c16527ff8080cae6b8).
Without this change, if an op is added that has invalid input shapes
and also requires a kernel label, the op will be added to the graph
before shape inference is run, but then the shape inference error will
prevent the kernel label from being applied. The placer will then
complain about the missing label when the graph is run.
This is only a problem with the C API disabled. With the C API
enabled, shape inference is performed when the TF_Operation is created
in Operation.__init__. Thus we can and should move the _add_op call
back to Operation.__init__ once the _USE_C_API flag is removed.
PiperOrigin-RevId: 177338123
Diffstat (limited to 'tensorflow/contrib/copy_graph')
-rw-r--r-- | tensorflow/contrib/copy_graph/python/util/copy_elements.py | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tensorflow/contrib/copy_graph/python/util/copy_elements.py b/tensorflow/contrib/copy_graph/python/util/copy_elements.py index d060eda0a7..bae66ffd42 100644 --- a/tensorflow/contrib/copy_graph/python/util/copy_elements.py +++ b/tensorflow/contrib/copy_graph/python/util/copy_elements.py @@ -225,6 +225,7 @@ def copy_op_to_graph(org_instance, to_graph, variables, new_original_op, op_def) #Use Graph's hidden methods to add the op + to_graph._add_op(new_op) # pylint: disable=protected-access to_graph._record_op_seen_by_control_dependencies(new_op) for device_function in reversed(to_graph._device_function_stack): new_op._set_device(device_function(new_op)) |