diff --git a/tensorflow/lite/micro/micro_allocator.cc b/tensorflow/lite/micro/micro_allocator.cc index 239a23335a6..5b62ae6c3b3 100644 --- a/tensorflow/lite/micro/micro_allocator.cc +++ b/tensorflow/lite/micro/micro_allocator.cc @@ -612,8 +612,9 @@ TfLiteStatus MicroAllocator::StartModelAllocation( TFLITE_DCHECK(subgraph != nullptr); model_is_allocating_ = true; + TF_LITE_ENSURE_STATUS(AllocateTfLiteTensorArray(context, subgraph)); TF_LITE_ENSURE_STATUS( - InitGraphAndContextTensorData(model, context, subgraph)); + PopulateTfLiteTensorArrayFromFlatbuffer(model, context, subgraph)); TF_LITE_ENSURE_STATUS( AllocateNodeAndRegistrations(subgraph, node_and_registrations)); TF_LITE_ENSURE_STATUS(PrepareNodeAndRegistrationDataFromFlatbuffer( @@ -866,14 +867,6 @@ ErrorReporter* MicroAllocator::error_reporter() const { return error_reporter_; } -TfLiteStatus MicroAllocator::InitGraphAndContextTensorData( - const Model* model, TfLiteContext* context, const SubGraph* subgraph) { - TF_LITE_ENSURE_STATUS(AllocateTfLiteTensorArray(context, subgraph)); - TF_LITE_ENSURE_STATUS( - PopulateTfLiteTensorArrayFromFlatbuffer(model, context, subgraph)); - return kTfLiteOk; -} - const SubGraph* MicroAllocator::GetSubGraphFromModel(const Model* model) { auto* subgraphs = model->subgraphs(); if (subgraphs->size() != 1) { diff --git a/tensorflow/lite/micro/micro_allocator.h b/tensorflow/lite/micro/micro_allocator.h index ab3f2a44d18..5fad5a2e5cc 100644 --- a/tensorflow/lite/micro/micro_allocator.h +++ b/tensorflow/lite/micro/micro_allocator.h @@ -179,11 +179,6 @@ class MicroAllocator { ErrorReporter* error_reporter() const; private: - // Initializes the graph and allocates TfLiteContext tensor data. - TfLiteStatus InitGraphAndContextTensorData(const Model* model, - TfLiteContext* context, - const SubGraph* subgraph); - // Returns the first subgraph from the model. const SubGraph* GetSubGraphFromModel(const Model* model);