#include "tensorflow/lite/arena_planner.h"
#include <stddef.h>
#include <algorithm>
#include <cstdint>
#include <limits>
#include <memory>
#include <utility>
#include <vector>
#include "tensorflow/lite/core/c/common.h"
#include "tensorflow/lite/graph_info.h"
#include "tensorflow/lite/simple_memory_arena.h"
namespace tflite {
constexpr int32_t kLastActiveNodeUndefined = …;
constexpr int32_t kNodeNotAssigned = …;
constexpr int32_t kScalarTensorBytes = …;
ArenaPlanner::ArenaPlanner(TfLiteContext* context,
std::unique_ptr<GraphInfo> graph_info,
bool preserve_all_tensors, int tensor_alignment,
int subgraph_index)
: … { … }
ArenaPlanner::~ArenaPlanner() { … }
std::intptr_t ArenaPlanner::BasePointer(TfLiteAllocationType type) { … }
TfLiteStatus ArenaPlanner::ResetAllocations() { … }
TfLiteStatus ArenaPlanner::ResetAllocationsAfter(int node) { … }
int ArenaPlanner::FindSharedTensor(int tensor_index) { … }
bool ArenaPlanner::InputTensorCanBeShared(const TfLiteTensor& input_tensor,
const TfLiteTensor& output_tensor,
int input_id, int output_id,
bool tensor_changed) { … }
void ArenaPlanner::IdentifyInPlaceTensors() { … }
TfLiteStatus ArenaPlanner::PlanAllocations() { … }
TfLiteStatus ArenaPlanner::ExecuteAllocations(int first_node, int last_node) { … }
TfLiteStatus ArenaPlanner::ReleaseNonPersistentMemory() { … }
TfLiteStatus ArenaPlanner::AcquireNonPersistentMemory() { … }
bool ArenaPlanner::HasNonPersistentMemory() { … }
void ArenaPlanner::DumpDebugInfo(const std::vector<int>& execution_plan) const { … }
void ArenaPlanner::GetAllocInfo(size_t* arena_size,
size_t* arena_persist_size) const { … }
TfLiteStatus ArenaPlanner::Commit(bool* reallocated) { … }
void ArenaPlanner::CreateTensorAllocationVector(
std::vector<int32_t>* tensors_to_allocate) { … }
std::vector<int32_t> ArenaPlanner::GetTensorsToAllocate(int first_node,
int last_node) { … }
TfLiteStatus ArenaPlanner::CalculateAllocations(
int first_node, int last_node, std::vector<int32_t>* tensors_allocated) { … }
bool AreTensorsAllocatedInSameArena(int32_t root_tensor_index,
int32_t tensor_index,
const TfLiteTensor* tensors) { … }
TfLiteStatus ArenaPlanner::ResolveTensorAllocation(int32_t tensor_index,
TfLiteTensor* tensors) { … }
}