| 267 | } |
| 268 | |
| 269 | TfLiteStatus ArenaPlanner::CalculateTensorAllocation(int tensor_index) { |
| 270 | TfLiteTensor& tensor = *graph_info_->tensor(tensor_index); |
| 271 | if (tensor.allocation_type == kTfLiteArenaRw) { |
| 272 | TF_LITE_ENSURE_STATUS(arena_.Allocate( |
| 273 | context_, tensor_alignment_, tensor.bytes, &allocs_[tensor_index])); |
| 274 | } |
| 275 | if (tensor.allocation_type == kTfLiteArenaRwPersistent) { |
| 276 | TF_LITE_ENSURE_STATUS(persistent_arena_.Allocate( |
| 277 | context_, tensor_alignment_, tensor.bytes, &allocs_[tensor_index])); |
| 278 | } |
| 279 | return kTfLiteOk; |
| 280 | } |
| 281 | |
| 282 | TfLiteStatus ArenaPlanner::CalculateTensorDeallocation(int tensor_index) { |
| 283 | TfLiteTensor& tensor = *graph_info_->tensor(tensor_index); |