diff options
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) |