diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2018-01-19 16:54:39 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-01-19 16:58:15 -0800 |
commit | f448189df9b62b6dd141ce14224dbfc0d8f0d11b (patch) | |
tree | dae9b38b72a6fe42de2ee68817dddc287988d4cb /tensorflow/core/grappler/optimizers/arithmetic_optimizer.h | |
parent | 677d733e8449580c77b57566c94e71224ffcfad0 (diff) |
Make sure the same rewrite is not performed multiple times in ArithmeticOptimizer, and that added nodes are unique.
A couple of minor cleanups.
PiperOrigin-RevId: 182609552
Diffstat (limited to 'tensorflow/core/grappler/optimizers/arithmetic_optimizer.h')
-rw-r--r-- | tensorflow/core/grappler/optimizers/arithmetic_optimizer.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tensorflow/core/grappler/optimizers/arithmetic_optimizer.h b/tensorflow/core/grappler/optimizers/arithmetic_optimizer.h index ec26979238..afd538db40 100644 --- a/tensorflow/core/grappler/optimizers/arithmetic_optimizer.h +++ b/tensorflow/core/grappler/optimizers/arithmetic_optimizer.h @@ -48,7 +48,13 @@ class ArithmeticOptimizer : public GraphOptimizer { private: // Returns true is a node with given name and the optimizer prefix already // exists. - bool OptimizedNodeExists(const string& name); + string OptimizedNodeName(const NodeDef& node, StringPiece suffix) const; + bool OptimizedNodeExists(const NodeDef& node, StringPiece suffix) const; + + // Creates a new node in the graph, with name equal to that of node, prefixed + // with "ArithmeticOptimizer/" and the given suffix. Also updates node_map_, + // and optionally copies node into the new node if copy_node is true. + NodeDef* AddNode(const NodeDef& node, StringPiece suffix, bool copy_node); // Creates a new node in the graph, prefixed with "ArithmeticOptimizer/", // updates node_map_, and optionally copies *node_to_copy into the new |