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

Method Deallocate

tensorflow/lite/simple_memory_arena.cc:83–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81}
82
83TfLiteStatus SimpleMemoryArena::Deallocate(TfLiteContext* context,
84 const ArenaAlloc& alloc) {
85 if (alloc.size == 0) {
86 return kTfLiteOk;
87 }
88
89 int erased_allocs_count = 0;
90 auto it = allocs_.begin();
91 while (it != allocs_.end()) {
92 if (it->offset == alloc.offset) {
93 TF_LITE_ENSURE_EQ(context, it->size, alloc.size);
94 erased_allocs_count++;
95 it = allocs_.erase(it);
96 } else {
97 ++it;
98 }
99 }
100 TF_LITE_ENSURE_EQ(context, erased_allocs_count, 1);
101 return kTfLiteOk;
102}
103
104TfLiteStatus SimpleMemoryArena::Commit(TfLiteContext* context) {
105 size_t required_size = RequiredBufferSize();

Callers 2

TESTFunction · 0.45

Calls 3

beginMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45

Tested by 1

TESTFunction · 0.36