[TFLite Export] Add variable, functions TfOpNodes for Fused OP export
authorDongHak Park <donghak.park@samsung.com>
Fri, 14 Apr 2023 08:27:46 +0000 (17:27 +0900)
committerJijoong Moon <jijoong.moon@samsung.com>
Mon, 21 Aug 2023 06:29:23 +0000 (15:29 +0900)
for Export Tflite format with Fused Op add some Variable and Function

1. Add getter, setter, replace to weights
- for Fused Op we need to adjust weights after made Opnode

2. Add isToBeRemove variable
- After made Opnode, check condition and mark as to be remove

3. Add additional_props
- for BatchNormalization Fused Op we need additional props from nntrainer
- made vector<float> variable for save additional data

Signed-off-by: DongHak Park <donghak.park@samsung.com>
nntrainer/compiler/tflite_opnode.cpp

index 1ad3a95..8d989c0 100644 (file)
@@ -125,15 +125,15 @@ void TfOpNode::setInputTransformFn(TransformFn fn) { input_transform = fn; }
 void TfOpNode::setWeights(Variables weights_) {
   unsigned int cnt = 0;
   for (auto &w : weights_) {
-    const unsigned int unit = w->batch();
-    const unsigned int channel = w->channel();
-    const unsigned int height = w->height();
-    const unsigned int width = w->width();
+    const unsigned int UNIT = w->batch();
+    const unsigned int CHANNEL = w->channel();
+    const unsigned int HEIGHT = w->height();
+    const unsigned int WIDTH = w->width();
 
     auto weight_data = weights.at(cnt)->getData();
     auto *ptr = const_cast<float *>(weight_data);
     memcpy(&ptr[0], &w->getData()[0],
-           sizeof(float) * (unit * channel * height * width));
+           sizeof(float) * (UNIT * CHANNEL * HEIGHT * WIDTH));
     cnt++;
   }
 }