diff options
author | Rachel Lim <rachelim@google.com> | 2018-10-03 11:24:41 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-10-03 11:29:40 -0700 |
commit | 47eafbaf43c763dc65a2cd3cfd9ecbd8fbbdf668 (patch) | |
tree | b9426571254706e767b5f09159c81b26bdf64d96 /tensorflow/core/graph | |
parent | 880dcb7a91e5ee497045614d9c5f4ab93c9ffacf (diff) |
[tf.data] Add utility to deduplicate graph node names (after vectorization)
PiperOrigin-RevId: 215595078
Diffstat (limited to 'tensorflow/core/graph')
-rw-r--r-- | tensorflow/core/graph/graph.cc | 5 | ||||
-rw-r--r-- | tensorflow/core/graph/graph.h | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/tensorflow/core/graph/graph.cc b/tensorflow/core/graph/graph.cc index 4c0cd14ff1..7a4a0096fa 100644 --- a/tensorflow/core/graph/graph.cc +++ b/tensorflow/core/graph/graph.cc @@ -192,6 +192,11 @@ void Node::ClearAttr(const string& name) { (*props_->node_def.mutable_attr()).erase(name); } +void Node::set_name(string name) { + MaybeCopyOnWrite(); + props_->node_def.set_name(std::move(name)); +} + void Node::set_requested_device(const string& device) { MaybeCopyOnWrite(); props_->node_def.set_device(device); diff --git a/tensorflow/core/graph/graph.h b/tensorflow/core/graph/graph.h index 72cef07072..2944951f82 100644 --- a/tensorflow/core/graph/graph.h +++ b/tensorflow/core/graph/graph.h @@ -72,6 +72,7 @@ class Node { int id() const { return id_; } int cost_id() const { return cost_id_; } const string& name() const; + void set_name(string name); const string& type_string() const; // def() provides the NodeDef the user supplied, but the specifics |