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

Function FunctionDefHash

tensorflow/core/framework/function.cc:862–892  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

860}
861
862uint64 FunctionDefHash(const FunctionDef& fdef) {
863 // signature
864 uint64 h = OpDefHash(fdef.signature());
865
866 // attrs
867 std::map<string, AttrValue> attrs = GetSetAttrs(fdef);
868 for (const auto& p : attrs) {
869 h = Hash64(p.first.data(), p.first.size(), h);
870 h = Hash64Combine(AttrValueHash(p.second), h);
871 }
872
873 // node defs
874 h = Hash64Combine(RepeatedNodeDefHash(fdef.node_def()), h);
875
876 // output names
877 std::map<string, string> ret(fdef.ret().begin(), fdef.ret().end());
878 for (const auto& p : ret) {
879 h = Hash64(p.first.data(), p.first.size(), h);
880 h = Hash64(p.second.data(), p.second.size(), h);
881 }
882
883 // control output names
884 std::map<string, string> control_ret(fdef.control_ret().begin(),
885 fdef.control_ret().end());
886 for (const auto& p : control_ret) {
887 h = Hash64(p.first.data(), p.first.size(), h);
888 h = Hash64(p.second.data(), p.second.size(), h);
889 }
890
891 return h;
892}
893
894static constexpr const char* const kExecutorAttr = "_executor";
895

Callers 2

TESTFunction · 0.85
GraphToFunctionDefFunction · 0.85

Calls 12

OpDefHashFunction · 0.85
GetSetAttrsFunction · 0.85
Hash64CombineFunction · 0.85
AttrValueHashFunction · 0.85
RepeatedNodeDefHashFunction · 0.85
signatureMethod · 0.80
Hash64Function · 0.50
dataMethod · 0.45
sizeMethod · 0.45
node_defMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by 1

TESTFunction · 0.68