[moco/tf] Revise ReLU6 unit test (#4247)
author박세희/On-Device Lab(SR)/Principal Engineer/삼성전자 <saehie.park@samsung.com>
Mon, 15 Jul 2019 01:36:41 +0000 (10:36 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Mon, 15 Jul 2019 01:36:41 +0000 (10:36 +0900)
This will revise ReLU6 unit test to test only related properties

Signed-off-by: SaeHie Park <saehie.park@samsung.com>
contrib/moco-tf/src/Op/Relu6.test.cpp

index 8636e2e..271b68c 100644 (file)
@@ -82,31 +82,12 @@ TEST(TensorFlowImport, relu6_01)
   EXPECT_TRUE(parse_graphdef(relu6_01_pbtxtdata, graph_def));
   std::unique_ptr<loco::Graph> graph = importer.import(signature, graph_def);
 
-  // Check input shape is correct
-  loco::Graph::InputContext *inputs = graph->inputs();
-  ASSERT_EQ(inputs->size(), 1);
-  loco::GraphInput *input = inputs->at(0);
-  loco::Pull *pull = input->node();
-  ASSERT_EQ(pull->dtype(), loco::DataType::FLOAT32);
-  ASSERT_EQ(pull->rank(), 2);
-  loco::Dimension dim2 = 2;
-  loco::Dimension dim3 = 3;
-  ASSERT_EQ(pull->dim(0).value(), dim2.value());
-  ASSERT_EQ(pull->dim(1).value(), dim3.value());
+  // what to test:
+  // - there should exist ReLU
+  // - input node should not be nullptr
 
-  // Check nodes are correct type
-  loco::Graph::OutputContext *outputs = graph->outputs();
-  ASSERT_EQ(outputs->size(), 1);
-  loco::GraphOutput *output = outputs->at(0);
-  loco::Push *push = output->node();
-  // Currently we don't know the shape of output node(s) so skip shape checking
+  loco::ReLU6 *relu6_node = moco::tf::test::find_first_node_bytype<loco::ReLU6>(graph.get());
 
-  loco::Graph::NodeContext *nodes = graph->nodes();
-  ASSERT_EQ(nodes->size(), 3);
-  loco::Pull *node0 = dynamic_cast<loco::Pull *>(nodes->at(0));
-  ASSERT_EQ(node0, pull);
-  loco::Push *node2 = dynamic_cast<loco::Push *>(nodes->at(2));
-  ASSERT_EQ(node2, push);
-  loco::ReLU6 *node1 = dynamic_cast<loco::ReLU6 *>(nodes->at(1));
-  ASSERT_NE(node1, nullptr);
+  ASSERT_NE(relu6_node, nullptr);
+  ASSERT_NE(relu6_node->input(), nullptr);
 }