MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / AttrValueHash

Function AttrValueHash

tensorflow/core/framework/attr_value_util.cc:133–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131using TensorProtoHasher = std::function<uint64(const TensorProto&)>;
132
133uint64 AttrValueHash(const AttrValue& a, const TensorProtoHasher& tensor_hash) {
134 if (a.has_tensor()) return tensor_hash(a.tensor());
135
136 if (a.has_func()) {
137 const NameAttrList& func = a.func();
138 uint64 h = Hash64(func.name());
139 std::map<string, AttrValue> map(func.attr().begin(), func.attr().end());
140 for (const auto& pair : map) {
141 h = Hash64(pair.first.data(), pair.first.size(), h);
142 h = Hash64Combine(AttrValueHash(pair.second, tensor_hash), h);
143 }
144 return h;
145 }
146
147 // If `a` is not a tensor or func, get a hash of serialized string.
148 return DeterministicProtoHash64(a);
149}
150
151template <typename TensorProtosEquality>
152bool AreAttrValuesEqual(const AttrValue& a, const AttrValue& b,

Callers 7

FastAttrValueHashFunction · 0.85
ExpectDifferentFunction · 0.85
TESTFunction · 0.85
AttrDefHashFunction · 0.85
FunctionDefHashFunction · 0.85
AbslHashValueMethod · 0.85
NodeDefHashFunction · 0.85

Calls 11

Hash64CombineFunction · 0.85
DeterministicProtoHash64Function · 0.85
attrMethod · 0.80
nameMethod · 0.65
Hash64Function · 0.50
tensorMethod · 0.45
funcMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by 2

ExpectDifferentFunction · 0.68
TESTFunction · 0.68