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

Method Build

tensorflow/core/profiler/internal/tfprof_code.cc:436–464  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

434}
435
436void TFCode::Build() {
437 int64 unaccounted_nodes = 0;
438 for (auto it : grad_nodes_) {
439 const string& forward_name = it.first;
440 auto forward_it = forward_nodes_.find(forward_name);
441 if (forward_it == forward_nodes_.end()) {
442 unaccounted_nodes += 1;
443 continue;
444 }
445 TFGraphNode* fn = forward_it->second;
446 CodeNode* leaf = nullptr;
447 CodeNode* pre_code_node = root_.get();
448 for (int i = 0; i < fn->call_stack()->traces().size(); ++i) {
449 const string& trace =
450 GetTraceString(fn->call_stack()->traces().at(i)) + kGradientSuffix;
451 pre_code_node = pre_code_node->AddChildren(
452 trace, &fn->call_stack()->traces().at(i), kGradientSuffix);
453 if (i == fn->call_stack()->traces().size() - 1) {
454 leaf = pre_code_node;
455 }
456 }
457 for (TFGraphNode* gn : it.second) {
458 leaf->node->AddGraphNode(gn);
459 }
460 }
461 if (unaccounted_nodes > 0) {
462 fprintf(stderr, "%lld gradient nodes not accounted\n", unaccounted_nodes);
463 }
464}
465
466const ShowMultiNode* TFCode::ShowInternal(const Options& opts,
467 Timeline* timeline) {

Callers

nothing calls this directly

Calls 9

GetTraceStringFunction · 0.85
call_stackMethod · 0.80
AddChildrenMethod · 0.80
AddGraphNodeMethod · 0.80
findMethod · 0.45
endMethod · 0.45
getMethod · 0.45
sizeMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected