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

Method FormatNode

tensorflow/core/profiler/internal/tfprof_op.cc:225–328  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

223}
224
225string TFOp::FormatNode(OpNode* node, OpNode* root, const Options& opts) const {
226 std::vector<string> attrs;
227
228 if (opts.select.find(kShown[0]) != opts.select.end()) {
229 attrs.push_back(FormatMemoryNode(node->proto().total_requested_bytes(),
230 root->proto().total_requested_bytes(),
231 node->proto().requested_bytes()));
232 }
233
234 if (opts.select.find(kShown[11]) != opts.select.end()) {
235 attrs.push_back(FormatMemoryNode(node->proto().total_peak_bytes(),
236 root->proto().total_peak_bytes(),
237 node->proto().peak_bytes()));
238 }
239
240 if (opts.select.find(kShown[12]) != opts.select.end()) {
241 attrs.push_back(FormatMemoryNode(node->proto().total_residual_bytes(),
242 root->proto().total_residual_bytes(),
243 node->proto().residual_bytes()));
244 }
245 if (opts.select.find(kShown[13]) != opts.select.end()) {
246 attrs.push_back(FormatMemoryNode(node->proto().total_output_bytes(),
247 root->proto().total_output_bytes(),
248 node->proto().output_bytes()));
249 }
250
251 if (opts.select.find(kShown[1]) != opts.select.end()) {
252 attrs.push_back(FormatToalExecTime(node, root));
253 attrs.push_back(FormatAcceleratorExecTime(node, root));
254 attrs.push_back(FormatCPUExecTime(node, root));
255 }
256 if (opts.select.find(kShown[9]) != opts.select.end() &&
257 opts.select.find(kShown[1]) == opts.select.end()) {
258 attrs.push_back(FormatAcceleratorExecTime(node, root));
259 }
260 if (opts.select.find(kShown[10]) != opts.select.end() &&
261 opts.select.find(kShown[1]) == opts.select.end()) {
262 attrs.push_back(FormatCPUExecTime(node, root));
263 }
264 if (opts.select.find(kShown[2]) != opts.select.end()) {
265 double accu_pct = 0.0;
266 double pct = 0.0;
267 if (node->proto().total_parameters() > 0) {
268 accu_pct = 100.0 * node->proto().total_parameters() /
269 root->proto().total_parameters();
270 pct =
271 100.0 * node->proto().parameters() / root->proto().total_parameters();
272 }
273 attrs.push_back(strings::Printf(
274 "%30s",
275 strings::Printf("%s params (%.2f%%, %.2f%%)",
276 FormatNumber(node->proto().parameters()).c_str(),
277 accu_pct, pct)
278 .c_str()));
279 }
280
281 if (opts.select.find(kShown[3]) != opts.select.end()) {
282 double accu_pct = 0.0;

Callers

nothing calls this directly

Calls 15

FormatToalExecTimeFunction · 0.85
PrintfFunction · 0.85
FormatNumberFunction · 0.85
protoMethod · 0.80
c_strMethod · 0.80
FormatCPUExecTimeFunction · 0.70
nameMethod · 0.65
findMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45
requested_bytesMethod · 0.45

Tested by

no test coverage detected