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

Function SummarizeAttrsHelper

tensorflow/core/framework/node_def_util.cc:55–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53AttrSlice::AttrSlice(const AttrValueMap* a) : ndef_(nullptr), attrs_(a) {}
54
55string SummarizeAttrsHelper(AttrSlice attrs, StringPiece device) {
56 string ret;
57
58 // We sort the attrs so the output is deterministic.
59 std::vector<string> attr_names;
60 attr_names.reserve(attrs.size());
61 for (const auto& attr : attrs) {
62 attr_names.push_back(attr.first);
63 }
64 std::sort(attr_names.begin(), attr_names.end());
65 bool first = true;
66 for (const string& attr_name : attr_names) {
67 if (!first) strings::StrAppend(&ret, ", ");
68 first = false;
69 strings::StrAppend(&ret, attr_name, "=",
70 SummarizeAttrValue(*attrs.Find(attr_name)));
71 }
72
73 // Consider the device to be a final attr with name "_device".
74 if (!device.empty()) {
75 if (!first) strings::StrAppend(&ret, ", ");
76 first = false;
77 strings::StrAppend(&ret, "_device=\"", device, "\"");
78 }
79 return ret;
80}
81
82string AttrSlice::SummarizeNode() const {
83 return ndef_ ? SummarizeNodeDef(*ndef_)

Callers 4

FindKernelDefFunction · 0.85
SummarizeNodeMethod · 0.85
SummarizeNodeDefFunction · 0.85
SummarizeAttrsFunction · 0.85

Calls 10

sortFunction · 0.85
SummarizeAttrValueFunction · 0.85
StrAppendFunction · 0.50
reserveMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
FindMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected