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"