From: 박종현/On-Device Lab(SR)/Staff Engineer/삼성전자 Date: Wed, 10 Jul 2019 04:05:27 +0000 (+0900) Subject: [moco/tf] Remove make_dimension(uint32_t) usage (#4172) X-Git-Tag: nncc_backup~137 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=78ce3a44eefaea2bfda54fad71ada05f6e03b633;p=platform%2Fcore%2Fml%2Fnnfw.git [moco/tf] Remove make_dimension(uint32_t) usage (#4172) This commit revises moco-tf not to invoke deprecated make_dimension(uint32_t). Signed-off-by: Jonghyun Park --- diff --git a/contrib/moco-tf/src/Annotations/ShapeInferenceData.cpp b/contrib/moco-tf/src/Annotations/ShapeInferenceData.cpp index 53cbd91..5115526 100644 --- a/contrib/moco-tf/src/Annotations/ShapeInferenceData.cpp +++ b/contrib/moco-tf/src/Annotations/ShapeInferenceData.cpp @@ -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(); } diff --git a/contrib/moco-tf/src/Importer.test.cpp b/contrib/moco-tf/src/Importer.test.cpp index 45fab3c..0c755f3 100644 --- a/contrib/moco-tf/src/Importer.test.cpp +++ b/contrib/moco-tf/src/Importer.test.cpp @@ -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()); diff --git a/contrib/moco-tf/src/Op/Const.cpp b/contrib/moco-tf/src/Op/Const.cpp index 4241c67..36035a7 100644 --- a/contrib/moco-tf/src/Op/Const.cpp +++ b/contrib/moco-tf/src/Op/Const.cpp @@ -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()}; } diff --git a/contrib/moco-tf/src/Op/Placeholder.cpp b/contrib/moco-tf/src/Op/Placeholder.cpp index 1171da5..e8f3c19 100644 --- a/contrib/moco-tf/src/Op/Placeholder.cpp +++ b/contrib/moco-tf/src/Op/Placeholder.cpp @@ -82,7 +82,7 @@ void PlaceholderGraphBuilder::build(const tensorflow::NodeDef &node, if (dim_value >= 0ULL) { uint32_t dim_value32 = static_cast(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; } } diff --git a/contrib/moco-tf/src/Op/Relu.test.cpp b/contrib/moco-tf/src/Op/Relu.test.cpp index 0c4d60e..5b2aa5a 100644 --- a/contrib/moco-tf/src/Op/Relu.test.cpp +++ b/contrib/moco-tf/src/Op/Relu.test.cpp @@ -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()); diff --git a/contrib/moco-tf/src/Op/Relu6.test.cpp b/contrib/moco-tf/src/Op/Relu6.test.cpp index 6104a5f..8636e2e 100644 --- a/contrib/moco-tf/src/Op/Relu6.test.cpp +++ b/contrib/moco-tf/src/Op/Relu6.test.cpp @@ -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()); diff --git a/contrib/moco-tf/src/Transforms/FixShapeTransform.cpp b/contrib/moco-tf/src/Transforms/FixShapeTransform.cpp index 5b3ce12..d5a7957 100644 --- a/contrib/moco-tf/src/Transforms/FixShapeTransform.cpp +++ b/contrib/moco-tf/src/Transforms/FixShapeTransform.cpp @@ -49,7 +49,7 @@ template 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(); } diff --git a/contrib/moco-tf/src/Transforms/ResolveFusedBatchNorm.cpp b/contrib/moco-tf/src/Transforms/ResolveFusedBatchNorm.cpp index eee7b42..827a89f 100644 --- a/contrib/moco-tf/src/Transforms/ResolveFusedBatchNorm.cpp +++ b/contrib/moco-tf/src/Transforms/ResolveFusedBatchNorm.cpp @@ -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(); }