diff options
author | Peter Hawkins <phawkins@google.com> | 2018-06-13 13:05:37 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-06-13 13:08:14 -0700 |
commit | 642a043de4901ddbf305db105168b8908adfe99e (patch) | |
tree | 30c5e1be065efaf9e0ec0fbe660ab0978b4736a4 /tensorflow/core/graph/graph.cc | |
parent | 8051c4b7790bb3cc64bf14d1180ab2ad55f0c032 (diff) |
[TF:XLA] Replace bespoke NodeSlot class in subgraph encapsulation code with InputTensor and OutputTensor classes from TF core.
Add equality and hash methods to InputTensor and OutputTensor.
No functional changes intended.
PiperOrigin-RevId: 200440015
Diffstat (limited to 'tensorflow/core/graph/graph.cc')
-rw-r--r-- | tensorflow/core/graph/graph.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tensorflow/core/graph/graph.cc b/tensorflow/core/graph/graph.cc index 0f748515ef..568f0870c0 100644 --- a/tensorflow/core/graph/graph.cc +++ b/tensorflow/core/graph/graph.cc @@ -24,6 +24,7 @@ limitations under the License. #include "tensorflow/core/graph/while_context.h" #include "tensorflow/core/lib/core/errors.h" #include "tensorflow/core/lib/gtl/map_util.h" +#include "tensorflow/core/lib/hash/hash.h" #include "tensorflow/core/lib/strings/strcat.h" #include "tensorflow/core/lib/strings/stringprintf.h" #include "tensorflow/core/platform/logging.h" @@ -265,6 +266,28 @@ Status Node::input_node(int idx, const Node** const_n) const { return Status::OK(); } +// InputTensor + +bool InputTensor::operator==(const InputTensor& other) const { + return node == other.node && index == other.index; +} + +uint64 InputTensor::Hash::operator()(InputTensor const& s) const { + return Hash64Combine(std::hash<const Node*>()(s.node), + std::hash<int>()(s.index)); +} + +// OutputTensor + +bool OutputTensor::operator==(const OutputTensor& other) const { + return node == other.node && index == other.index; +} + +uint64 OutputTensor::Hash::operator()(OutputTensor const& s) const { + return Hash64Combine(std::hash<const Node*>()(s.node), + std::hash<int>()(s.index)); +} + // Graph Graph::Graph(const OpRegistryInterface* ops) |