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

Method Initialize

tensorflow/core/common_runtime/graph_view.cc:245–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

243}
244
245Status GraphView::Initialize(const Graph* g) {
246 CHECK(node_offsets_ == nullptr);
247 const int num_nodes = g->num_node_ids();
248 num_nodes_ = num_nodes;
249 size_t total_bytes = 0;
250 for (const Node* n : g->nodes()) {
251 if (n->out_edges().size() > kint32max) {
252 return errors::InvalidArgument(
253 "The executor cannot handle nodes with more than ", kint32max,
254 " output edges. Node ", n->name(), " had ", n->out_edges().size(),
255 " output edges.");
256 }
257 total_bytes += NodeItemBytes(n);
258 }
259
260 node_offsets_ = new uint32[num_nodes];
261 for (int i = 0; i < num_nodes; i++) {
262 node_offsets_[i] = kuint32max;
263 }
264
265 space_ = new char[total_bytes]; // NodeItem objects are allocated here
266 char* ptr = space_;
267 for (const Node* n : g->nodes()) {
268 ptr = InitializeNode(ptr, n);
269 }
270 CHECK_EQ(ptr, space_ + total_bytes);
271 return Status::OK();
272}
273
274namespace {
275// If a Node has been marked to use a ScopedAllocator x for output i, then

Callers 4

RunMethod · 0.45
TESTFunction · 0.45
CreateRendezvousMethod · 0.45

Calls 5

InvalidArgumentFunction · 0.85
nameMethod · 0.65
num_node_idsMethod · 0.45
nodesMethod · 0.45
sizeMethod · 0.45

Tested by 2

TESTFunction · 0.36