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

Method PrintScope

tensorflow/core/profiler/internal/tfprof_scope.cc:145–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143}
144
145std::vector<ScopeNode*> TFScope::PrintScope(const std::vector<ScopeNode*> roots,
146 const Options& opts, int depth,
147 int last_ident) {
148 std::vector<ScopeNode*> show_nodes;
149
150 for (ScopeNode* node : roots) {
151 int ident = last_ident;
152 bool show = ShouldShow(node, opts, depth);
153 if (show) ident += 2;
154
155 std::vector<ScopeNode*> show_cnodes;
156 if (!ShouldTrim(node, opts.trim_name_regexes) && depth <= opts.max_depth) {
157 show_cnodes = PrintScope(node->show_children, opts, depth + 1, ident);
158 }
159 if (show) {
160 node->show_children.clear();
161 if (opts.account_displayed_op_only) {
162 node->ResetTotalStats();
163 node->AddSelfToTotalStats();
164 }
165
166 show_cnodes = SortNodes(show_cnodes, opts);
167 for (ScopeNode* sc : show_cnodes) {
168 node->show_children.push_back(sc);
169 if (opts.account_displayed_op_only) {
170 node->AggregateTotalStats(sc);
171 }
172 }
173
174 node->formatted_str =
175 strings::Printf("%s%s\n", string(last_ident, ' ').c_str(),
176 FormatNode(node, opts).c_str());
177
178 if (opts.select.find(kShown[4]) != opts.select.end()) {
179 std::unique_ptr<TFProfTensor> tfprof_tensor;
180 if (LookUpCheckPoint(node->name(), &tfprof_tensor)) {
181 string value_str;
182 tfprof_tensor->Display(&value_str,
183 node->mutable_proto()->mutable_tensor_value());
184 node->formatted_str += value_str;
185 }
186 }
187 show_nodes.push_back(node);
188 } else {
189 show_nodes.insert(show_nodes.end(), show_cnodes.begin(),
190 show_cnodes.end());
191 }
192 }
193 return show_nodes;
194}
195
196std::vector<ScopeNode*> TFScope::Account(const std::vector<ScopeNode*>& roots,
197 const Options& opts) {

Callers

nothing calls this directly

Calls 14

PrintfFunction · 0.85
ResetTotalStatsMethod · 0.80
AddSelfToTotalStatsMethod · 0.80
AggregateTotalStatsMethod · 0.80
c_strMethod · 0.80
DisplayMethod · 0.80
nameMethod · 0.65
clearMethod · 0.45
push_backMethod · 0.45
findMethod · 0.45
endMethod · 0.45
mutable_protoMethod · 0.45

Tested by

no test coverage detected