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);
}