diff options
author | 2018-05-14 10:43:08 -0700 | |
---|---|---|
committer | 2018-05-14 10:45:35 -0700 | |
commit | 5fb7401959391f7583087f404a48353ab21ef1ca (patch) | |
tree | 7413cfeec40ad33a8c4468219bbdf234fe9a6ed4 /tensorflow/core/lib/hash | |
parent | 157c347f832413c29265e467cc733366b4b215a6 (diff) |
Use utility methods to compute AttrValue hash code and check for equality.
PiperOrigin-RevId: 196531355
Diffstat (limited to 'tensorflow/core/lib/hash')
-rw-r--r-- | tensorflow/core/lib/hash/hash.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tensorflow/core/lib/hash/hash.h b/tensorflow/core/lib/hash/hash.h index 3f85303c0f..737d23f699 100644 --- a/tensorflow/core/lib/hash/hash.h +++ b/tensorflow/core/lib/hash/hash.h @@ -44,6 +44,12 @@ inline uint64 Hash64Combine(uint64 a, uint64 b) { return a ^ (b + 0x9e3779b97f4a7800ULL + (a << 10) + (a >> 4)); } +// Combine two hashes in an order-independent way. This operation should be +// associative and compute the same hash for a collection of elements +// independent of traversal order. Note that it is better to combine hashes +// symmetrically with addition rather than XOR, since (x^x) == 0 but (x+x) != 0. +inline uint64 Hash64CombineUnordered(uint64 a, uint64 b) { return a + b; } + // Hash functor suitable for use with power-of-two sized hashtables. Use // instead of std::hash<T>. // |