From 4bf7119c3f569b9545a6c742e6234acac48425de Mon Sep 17 00:00:00 2001 From: SaeHie Park Date: Mon, 12 Aug 2024 04:42:19 +0000 Subject: [PATCH] [tflchef] Extract init method This will extract init method for flatbuffer_builder initialization. ONE-DCO-1.0-Signed-off-by: SaeHie Park --- compiler/tflchef/core/src/ModelChef.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/compiler/tflchef/core/src/ModelChef.cpp b/compiler/tflchef/core/src/ModelChef.cpp index 5f5a16f6ca3..9cb38d9730e 100644 --- a/compiler/tflchef/core/src/ModelChef.cpp +++ b/compiler/tflchef/core/src/ModelChef.cpp @@ -179,6 +179,7 @@ namespace struct ModelChef { + void init(void); void cook(const ::tflchef::ModelRecipe &model_recipe); template std::map cook_graph(const T &graph); @@ -194,6 +195,12 @@ struct ModelChef std::string _graph_name; }; +void ModelChef::init(void) +{ + flatbuffer_builder = + std::unique_ptr(new flatbuffers::FlatBufferBuilder(1024)); +} + std::vector> make_dim_metadata_vec(flatbuffers::FlatBufferBuilder *flatbuffer_builder, int32_t dims_count, const std::vector &traversal_order_vec, @@ -933,9 +940,7 @@ GeneratedModel cook(const ::tflchef::ModelRecipe &model_recipe) ModelChef &mc = gen_model->model_chef(); - mc.flatbuffer_builder = - std::unique_ptr(new flatbuffers::FlatBufferBuilder(1024)); - + mc.init(); mc.cook(model_recipe); // Return "GenerateModel"