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

Method Initialize

tensorflow/core/common_runtime/kernel_stat.h:79–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77 }
78
79 void Initialize(const GraphView& gview,
80 const Graph* g) {
81 gv_ = const_cast<GraphView*>(&gview);
82 g_ = const_cast<Graph*>(g);
83
84 nodes_count_ = gview.num_nodes();
85 is_expensive_.resize(gview.num_nodes());
86 cost_estimates_ =
87 absl::make_unique<std::atomic_uint_fast64_t[]>(gview.num_nodes());
88 immutable_avg_cost_ =
89 absl::make_unique<std::atomic<int64_t>[]>(gview.num_nodes());
90 node_stats_count_ =
91 absl::make_unique<std::atomic<int32_t>[]>(gview.num_nodes());
92 task_count_ =
93 absl::make_unique<std::atomic<int32_t>[]>(gview.num_nodes());
94 for (int32_t i = 0; i < gview.num_nodes(); ++i) {
95 if (gview.node(i)) {
96 is_expensive_[i] =
97 gview.node(i)->kernel && gview.node(i)->kernel->IsExpensive();
98 cost_estimates_[i] = kInitialCostEstimateCycles;
99 immutable_avg_cost_[i] = 0;
100 node_stats_count_[i] = 0;
101 task_count_[i] = 0;
102 }
103 }
104 }
105
106 // Returns true iff the given node is considered "expensive". The
107 // executor uses this flag to optimize graph execution, for example

Callers

nothing calls this directly

Calls 4

num_nodesMethod · 0.45
resizeMethod · 0.45
nodeMethod · 0.45
IsExpensiveMethod · 0.45

Tested by

no test coverage detected