aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/graph_editor
diff options
context:
space:
mode:
authorGravatar Skye Wanderman-Milne <skyewm@google.com>2017-11-29 11:27:08 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-11-29 11:30:33 -0800
commit71f22bbab05e25c5f026c4343664091cc117b5ab (patch)
treed1f8c5ac273f632a51f709cfa879294adeab2c0f /tensorflow/contrib/graph_editor
parent78a4873cfa4562cf071492636f03e13fcb188bd8 (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/graph_editor')
-rw-r--r--tensorflow/contrib/graph_editor/transform.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/tensorflow/contrib/graph_editor/transform.py b/tensorflow/contrib/graph_editor/transform.py
index 2a97a79070..14ac529665 100644
--- a/tensorflow/contrib/graph_editor/transform.py
+++ b/tensorflow/contrib/graph_editor/transform.py
@@ -173,6 +173,9 @@ def copy_op_handler(info, op, copy_shape=True):
if op._original_op:
op_._original_op = op._original_op
+ # Add op to the graph
+ info.graph_._add_op(op_)
+
return op_, op_.outputs