[moco-tf] Use make_shape_inference_data in fix_shape (#6998)
author박세희/On-Device Lab(SR)/Principal Engineer/삼성전자 <saehie.park@samsung.com>
Thu, 29 Aug 2019 00:38:47 +0000 (09:38 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Thu, 29 Aug 2019 00:38:47 +0000 (09:38 +0900)
This will use make_shape_inference_data() for patterns of make_unique() + copy_shape_values() with ShapeInferenceData

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

index 7467b01..8304c61 100644 (file)
@@ -147,8 +147,7 @@ bool copy_shapedata(const loco::Node *src, loco::Node *dst)
   if (src_shapedata == nullptr)
     return false;
 
-  auto shape_data = stdex::make_unique<ShapeInferenceData>();
-  copy_shape_values(src_shapedata, shape_data.get());
+  auto shape_data = make_shape_inference_data(src_shapedata);
   dst->annot(std::move(shape_data));
 
   return true;
@@ -731,10 +730,9 @@ bool fix_shape(loco::Pull *node)
     // shape inference is already done for Pull
     return false;
   }
-  auto shape_data = stdex::make_unique<ShapeInferenceData>();
 
   // Pull itself has shape information, copy them
-  copy_shape_values(node, shape_data.get());
+  auto shape_data = make_shape_inference_data(node);
   node->annot(std::move(shape_data));
 
   return true;
@@ -1105,8 +1103,7 @@ bool fix_shape(moco::tf::TFConst *node)
   }
 
   // TFConst itself has shape information, copy them
-  auto shape_data = stdex::make_unique<ShapeInferenceData>();
-  copy_shape_values(node, shape_data.get());
+  auto shape_data = make_shape_inference_data(node);
   node->annot(std::move(shape_data));
 
   {
@@ -1715,8 +1712,7 @@ bool fix_shape(locoex::COpCall *node)
   if (shapedata != nullptr)
     return false;
 
-  auto shape_data = stdex::make_unique<ShapeInferenceData>();
-  copy_shape_values(node, shape_data.get()); // copy node's TensorShape info to ShapeInferenceData
+  auto shape_data = make_shape_inference_data(node);
   node->annot(std::move(shape_data));
 
   return true;