[moco/tf] revise test for shape inf feature (#3931)
author박세희/On-Device Lab(SR)/Principal Engineer/삼성전자 <saehie.park@samsung.com>
Mon, 24 Jun 2019 00:07:11 +0000 (09:07 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Mon, 24 Jun 2019 00:07:11 +0000 (09:07 +0900)
This will revise feature_shape accessors test in shape inference data to remove implementation detail and focus on interface testing

Signed-off-by: SaeHie Park <saehie.park@samsung.com>
contrib/moco/lib/frontend/tf/src/Annotations/ShapeInferenceData.test.cpp

index 700a340..54c885b 100644 (file)
@@ -37,45 +37,25 @@ TEST(TensorFlowFrontend, shapeinferencedata_tensor_get)
   ASSERT_EQ(tensor.dim(3), 4);
 }
 
-TEST(TensorFlowFrontend, shapeinferencedata_feature_set)
+TEST(TensorFlowFrontend, shapeinferencedata_feature)
 {
-  loco::FeatureShape feature;
+  loco::FeatureShape feature_s;
 
-  feature.count() = 1;
-  feature.height() = 2;
-  feature.width() = 3;
-  feature.depth() = 4;
+  feature_s.count() = 1;
+  feature_s.height() = 2;
+  feature_s.width() = 3;
+  feature_s.depth() = 4;
 
   moco::tf::ShapeInferenceData shapedata;
 
-  shapedata.feature_shape(feature);
+  shapedata.feature_shape(feature_s);
 
-  ASSERT_EQ(shapedata.rank(), 4);
-  ASSERT_EQ(shapedata.dim(0), 1);
-  ASSERT_EQ(shapedata.dim(1), 2);
-  ASSERT_EQ(shapedata.dim(2), 3);
-  ASSERT_EQ(shapedata.dim(3), 4);
-}
-
-TEST(TensorFlowFrontend, shapeinferencedata_feature_get)
-{
-  moco::tf::ShapeInferenceData shapedata;
-  loco::FeatureShape dummy;
-
-  shapedata.feature_shape(dummy); // this is to set domain to feature
-
-  shapedata.rank(4);
-  shapedata.dim(0) = 1;
-  shapedata.dim(1) = 2;
-  shapedata.dim(2) = 3;
-  shapedata.dim(3) = 4;
-
-  loco::FeatureShape feature = shapedata.feature_shape();
+  loco::FeatureShape feature_g = shapedata.feature_shape();
 
-  ASSERT_EQ(feature.count(), 1);
-  ASSERT_EQ(feature.height(), 2);
-  ASSERT_EQ(feature.width(), 3);
-  ASSERT_EQ(feature.depth(), 4);
+  ASSERT_EQ(feature_g.count(), 1);
+  ASSERT_EQ(feature_g.height(), 2);
+  ASSERT_EQ(feature_g.width(), 3);
+  ASSERT_EQ(feature_g.depth(), 4);
 }
 
 TEST(TensorFlowFrontend, shapeinferencedata_filter)