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

Method ExecuteAllocations

tensorflow/lite/arena_planner.cc:187–205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

185}
186
187TfLiteStatus ArenaPlanner::ExecuteAllocations(int first_node, int last_node) {
188 // Grow the size of `allocs_` if necessary. This allows allocating temporary
189 // tensors in op's `prepare` function.
190 TF_LITE_ENSURE(context_, graph_info_->num_tensors() >= allocs_.size());
191 allocs_.resize(graph_info_->num_tensors());
192
193 TF_LITE_ENSURE_STATUS(CalculateAllocations(first_node, last_node));
194 TF_LITE_ENSURE_STATUS(Commit());
195
196 for (int i = 0; i < static_cast<int>(graph_info_->num_tensors()); ++i) {
197 // TODO(ahentz): we could do this only for the tensors that were modified
198 // in CalculateAllocations(), instead of redoing it for tensors that
199 // already had proper pointers. However we must be very careful, because
200 // SimpleMemoryArena::Commit() could move the base pointer.
201 TF_LITE_ENSURE_STATUS(ResolveTensorAllocation(i));
202 }
203
204 return kTfLiteOk;
205}
206
207TfLiteStatus ArenaPlanner::Commit() {
208 TF_LITE_ENSURE_STATUS(arena_.Commit(context_));

Callers 3

ExecuteMethod · 0.80
TEST_FFunction · 0.80
PrepareOpsAndTensorsMethod · 0.80

Calls 3

num_tensorsMethod · 0.45
sizeMethod · 0.45
resizeMethod · 0.45

Tested by 2

ExecuteMethod · 0.64
TEST_FFunction · 0.64