[moco/tf] Remove make_dimension(uint32_t) usage (#4172)
author박종현/On-Device Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Wed, 10 Jul 2019 04:05:27 +0000 (13:05 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Wed, 10 Jul 2019 04:05:27 +0000 (13:05 +0900)
This commit revises moco-tf not to invoke deprecated
make_dimension(uint32_t).

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
contrib/moco-tf/src/Annotations/ShapeInferenceData.cpp
contrib/moco-tf/src/Importer.test.cpp
contrib/moco-tf/src/Op/Const.cpp
contrib/moco-tf/src/Op/Placeholder.cpp
contrib/moco-tf/src/Op/Relu.test.cpp
contrib/moco-tf/src/Op/Relu6.test.cpp
contrib/moco-tf/src/Transforms/FixShapeTransform.cpp
contrib/moco-tf/src/Transforms/ResolveFusedBatchNorm.cpp

index 53cbd91..5115526 100644 (file)
@@ -33,7 +33,7 @@ loco::TensorShape ShapeInferenceData::tensor_shape(void) const
   for (uint32_t r = 0; r < rank(); ++r)
   {
     if (dim(r).known())
-      shape.dim(r) = loco::make_dimension(dim(r).value());
+      shape.dim(r) = dim(r).value();
     else
       shape.dim(r).unset();
   }
@@ -95,7 +95,7 @@ void ShapeInferenceData::tensor_shape(const loco::TensorShape &shape)
   for (uint32_t r = 0; r < shape.rank(); ++r)
   {
     if (shape.dim(r).known())
-      dim(r) = loco::make_dimension(shape.dim(r).value());
+      dim(r) = shape.dim(r).value();
     else
       dim(r).unset();
   }
index 45fab3c..0c755f3 100644 (file)
@@ -95,8 +95,8 @@ TEST(TensorFlowImport, load_model_withio)
   loco::Pull *pull = input->node();
   ASSERT_EQ(pull->dtype(), loco::DataType::FLOAT32);
   ASSERT_EQ(pull->rank(), 4);
-  loco::Dimension dim1 = loco::make_dimension(1);
-  loco::Dimension dim2 = loco::make_dimension(2);
+  loco::Dimension dim1 = 1;
+  loco::Dimension dim2 = 2;
   ASSERT_EQ(pull->dim(0).value(), dim1.value());
   ASSERT_EQ(pull->dim(1).value(), dim2.value());
   ASSERT_EQ(pull->dim(2).value(), dim1.value());
index 4241c67..36035a7 100644 (file)
@@ -150,7 +150,7 @@ void ConstGraphBuilder::build(const tensorflow::NodeDef &node, GraphBuilderConte
       zero_sized_shape = true;
 
     if (d.size() >= 0)
-      const_node->dim(index++) = loco::make_dimension(d.size());
+      const_node->dim(index++) = d.size();
     else
       throw std::runtime_error{"Error: Unknown dim size for " + node.name()};
   }
index 1171da5..e8f3c19 100644 (file)
@@ -82,7 +82,7 @@ void PlaceholderGraphBuilder::build(const tensorflow::NodeDef &node,
       if (dim_value >= 0ULL)
       {
         uint32_t dim_value32 = static_cast<uint32_t>(dim_value);
-        pull_node->dim(d) = loco::make_dimension(dim_value32);
+        pull_node->dim(d) = dim_value32;
       }
       else
       {
@@ -113,7 +113,7 @@ void PlaceholderGraphBuilder::build(const tensorflow::NodeDef &node,
         throw std::runtime_error("Shape that user entered is different from shape in Placeholder");
 
       // set shape of pull
-      pull_node->dim(d) = loco::make_dimension(arg_dim);
+      pull_node->dim(d) = arg_dim;
     }
   }
 
index 0c4d60e..5b2aa5a 100644 (file)
@@ -89,8 +89,8 @@ TEST(TensorFlowImport, relu_01)
   loco::Pull *pull = input->node();
   ASSERT_EQ(pull->dtype(), loco::DataType::FLOAT32);
   ASSERT_EQ(pull->rank(), 2);
-  loco::Dimension dim2 = loco::make_dimension(2);
-  loco::Dimension dim3 = loco::make_dimension(3);
+  loco::Dimension dim2 = 2;
+  loco::Dimension dim3 = 3;
   ASSERT_EQ(pull->dim(0).value(), dim2.value());
   ASSERT_EQ(pull->dim(1).value(), dim3.value());
 
index 6104a5f..8636e2e 100644 (file)
@@ -89,8 +89,8 @@ TEST(TensorFlowImport, relu6_01)
   loco::Pull *pull = input->node();
   ASSERT_EQ(pull->dtype(), loco::DataType::FLOAT32);
   ASSERT_EQ(pull->rank(), 2);
-  loco::Dimension dim2 = loco::make_dimension(2);
-  loco::Dimension dim3 = loco::make_dimension(3);
+  loco::Dimension dim2 = 2;
+  loco::Dimension dim3 = 3;
   ASSERT_EQ(pull->dim(0).value(), dim2.value());
   ASSERT_EQ(pull->dim(1).value(), dim3.value());
 
index 5b3ce12..d5a7957 100644 (file)
@@ -49,7 +49,7 @@ template <class T> void copy_shape_values(const T *src, ShapeInferenceData *dst)
   for (uint32_t index = 0; index < rank; ++index)
   {
     if (src->dim(index).known())
-      dst->dim(index) = loco::make_dimension(src->dim(index).value());
+      dst->dim(index) = src->dim(index).value();
     else
       dst->dim(index).unset();
   }
@@ -538,7 +538,7 @@ bool fix_shape(loco::TensorConcat *node)
     uint32_t new_dim = (index == axis_loco) ? lhs_dim + rhs_dim : lhs_dim;
 
     if (lhs_shapedata->dim(index).known())
-      shape_data->dim(index) = loco::make_dimension(new_dim);
+      shape_data->dim(index) = new_dim;
     else
       shape_data->dim(index).unset();
   }
index eee7b42..827a89f 100644 (file)
@@ -56,7 +56,7 @@ void copy_shape(const loco::ConstGen *src, loco::ConstGen *dst)
   for (uint32_t index = 0; index < rank; ++index)
   {
     if (src->dim(index).known())
-      dst->dim(index) = loco::make_dimension(src->dim(index).value());
+      dst->dim(index) = src->dim(index).value();
     else
       dst->dim(index).unset();
   }