aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/graph_editor
diff options
context:
space:
mode:
authorGravatar Skye Wanderman-Milne <skyewm@google.com>2017-11-17 17:00:30 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-11-17 17:07:51 -0800
commitf4c18a0eb05e21bae397c9c16527ff8080cae6b8 (patch)
tree9fbaa8ae02e56e029ef8eba20b3b6279c474f55a /tensorflow/contrib/graph_editor
parentee26ea9ffde6773863badc00001342a368fae39a (diff)
Call Graph._add_op in Operation.__init__ (and remove existing calls).
Without this change, ops manually constructed via Operation.__init__ must be passed to Graph._add_op to keep the graph in a consistent state. Failure to do so is particularly disasterous with the C API enabled, as more Operation methods rely on Graph._nodes_by_name, which is updated in Graph._add_op (e.g. Operation.inputs will fail if the inputs have not been added to the graph). An alternative to this change is to require that all Operation.__init__ callers also call Graph._add_op (we don't currently do this in ops_test.py, although I imagine all non-test callers do). While this is effectively the current contract, it forces callers of Operation.__init__, which is a public API, to use _add_op, which is private. One downside of this change is that it will break existing Graph._add_op calls, since the op will already have been added. However, _add_op is a private API. PiperOrigin-RevId: 176180386
Diffstat (limited to 'tensorflow/contrib/graph_editor')
-rw-r--r--tensorflow/contrib/graph_editor/transform.py3
1 files changed, 0 insertions, 3 deletions
diff --git a/tensorflow/contrib/graph_editor/transform.py b/tensorflow/contrib/graph_editor/transform.py
index 14ac529665..2a97a79070 100644
--- a/tensorflow/contrib/graph_editor/transform.py
+++ b/tensorflow/contrib/graph_editor/transform.py
@@ -173,9 +173,6 @@ 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