/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #ifndef TENSORFLOW_LITE_ARENA_PLANNER_H_ #define TENSORFLOW_LITE_ARENA_PLANNER_H_ #include <cstddef> #include <cstdint> #include <memory> #include <unordered_map> #include <unordered_set> #include <vector> #include "tensorflow/lite/core/c/common.h" #include "tensorflow/lite/graph_info.h" #include "tensorflow/lite/memory_planner.h" #include "tensorflow/lite/simple_memory_arena.h" #include "tensorflow/lite/util.h" namespace tflite { constexpr const int kDefaultArenaAlignment = …; // A memory planner that makes all the allocations using arenas. // // Before a model is executed by the interpreter, this class determines when // each tensor needs to be allocated and deallocated, and preallocates all the // necessary memory (the PlanAllocations phase). It then assigns portions of // this memory buffer to each tensor (the ExecuteAllocations phase). Tensors may // share some of the buffer if a tensor B is to be allocated after another // tensor A has been deallocated. // // If dynamic tensors are used the planning steps can be repeated during model // execution. Since dynamic tensors don't have sizes until after the // corresponding operation is executed, this class supports incremental // planning. class ArenaPlanner : public MemoryPlanner { … }; } // namespace tflite #endif // TENSORFLOW_LITE_ARENA_PLANNER_H_