[moco-tf] Fix pad for TF dialect nodes in FixShape (#6302)
author박세희/On-Device Lab(SR)/Principal Engineer/삼성전자 <saehie.park@samsung.com>
Wed, 7 Aug 2019 06:42:17 +0000 (15:42 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Wed, 7 Aug 2019 06:42:17 +0000 (15:42 +0900)
This will merge fix pad for TF dialect nodes in FixShapeInference using calc_annot_paddata() method

Signed-off-by: SaeHie Park <saehie.park@samsung.com>
compiler/moco-tf/src/Transforms/FixShapeTransform.cpp

index 65ec1e5..b9261a2 100644 (file)
@@ -1028,8 +1028,14 @@ bool fix_shape(moco::tf::TFDepthwiseConv2dNative *node)
   shape_data->tensor_shape(ofm_tensor_shape);
   node->annot(std::move(shape_data));
 
+  FixPadContext ctx = {input_height,  input_width,  output_height,        output_width,
+                       stride_height, stride_width, effective_ker_height, effective_ker_width};
+
+  calc_annot_paddata(node, ctx);
+
   INFO(l) << "Fix TFDepthwiseConv2dNative shape = ifm" << ifm_tensor_shape << " ker"
           << ker_tensor_shape << " --> ofm" << ofm_tensor_shape;
+  INFO(l) << "                            pad = " << *node->annot<PadData>();
 
   return true;
 }
@@ -1150,7 +1156,14 @@ bool fix_shape(moco::tf::TFMaxPool *node)
   as_tensor_shape(*shape_data.get(), ofm_feature_shape, node->data_layout());
   node->annot(std::move(shape_data));
 
+  FixPadContext ctx = {
+      input_height,  input_width,  output_height,           output_width,
+      stride_height, stride_width, effective_window_height, effective_window_width};
+
+  calc_annot_paddata(node, ctx);
+
   INFO(l) << "Fix TFMaxPool shape = ifm" << value_feature_shape << " --> ofm" << ofm_feature_shape;
+  INFO(l) << "              pad = " << *node->annot<PadData>();
 
   return true;
 }