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

Function HashAttr

tensorflow/core/kernels/data/dataset_utils.cc:174–196  ·  view source on GitHub ↗

Produces a hash of a attribute from an op or a function. Since attributes may refer to functions present in the graph, we may need to hash the function referred to by the attribute, and thus we need the FunctionDefLibrary.

Source from the content-addressed store, hash-verified

172// may refer to functions present in the graph, we may need to hash the function
173// referred to by the attribute, and thus we need the FunctionDefLibrary.
174uint64 HashAttr(const FunctionDefLibrary& library, const std::string& attr_key,
175 const AttrValue& attr_value, std::vector<std::string>* visited,
176 absl::flat_hash_map<std::string, uint64>* cache) {
177 uint64 attr_hash = 0;
178 if (attr_value.has_func()) {
179 for (const auto& func : library.function()) {
180 if (func.signature().name() == attr_value.func().name()) {
181 attr_hash = Hash64CombineUnordered(
182 attr_hash,
183 Hash64(absl::StrCat(
184 attr_key, "=",
185 HashSubgraphFunctionImpl(library, &func, visited, cache))));
186 break;
187 }
188 }
189 } else {
190 attr_hash = Hash64CombineUnordered(
191 attr_hash, Hash64(absl::StrCat(attr_key, "=",
192 DeterministicProtoHash64(attr_value))));
193 }
194
195 return attr_hash;
196}
197
198// This function hashes a subgraph (rooted at node) by traversing all possible
199// dependency paths from that node.

Callers 2

HashSubgraphImplFunction · 0.85
HashSubgraphFunctionImplFunction · 0.85

Calls 9

Hash64CombineUnorderedFunction · 0.85
HashSubgraphFunctionImplFunction · 0.85
DeterministicProtoHash64Function · 0.85
signatureMethod · 0.80
nameMethod · 0.65
Hash64Function · 0.50
StrCatFunction · 0.50
functionMethod · 0.45
funcMethod · 0.45

Tested by

no test coverage detected