[tflite_export] Set model batch 1
authorDonghak PARK <donghak.park@samsung.com>
Tue, 29 Aug 2023 13:32:56 +0000 (22:32 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Mon, 4 Sep 2023 05:43:33 +0000 (14:43 +0900)
Now, After train the model and export it to the tflite format, it will be exported with the batch size used for learning.
However, for interference, it is not necessary to have a batch size, and when converting to a tensorflow lite format in tensorflow, the batch size is set to 1.

Signed-off-by: Donghak PARK <donghak.park@samsung.com>
nntrainer/models/neuralnet.cpp

index e9f315c..f776d00 100644 (file)
@@ -1334,6 +1334,7 @@ void NeuralNetwork::exports(const ml::train::ExportMethods &method,
     /// `dealloc_weights == false`
     model_graph.deallocateTensors();
     model_graph.allocateTensors(ExecutionMode::INFERENCE);
+    model_graph.setBatchSize(1); // For now, to inference batch size to be 1
     interpreter.serialize(graph_representation, file_path);
     model_graph.deallocateTensors();
 #else