Commit 2856e1c1 authored by Robert Kimball's avatar Robert Kimball Committed by Scott Cyphers

Debug cleanup when running unit tests (#3793)

* Remove debug output

* More cleanup
parent 698aeb2f
...@@ -375,9 +375,7 @@ TEST(algebraic_simplification, concat_reshape_slice) ...@@ -375,9 +375,7 @@ TEST(algebraic_simplification, concat_reshape_slice)
auto concat = make_shared<op::Concat>(NodeVector{reshape1, reshape2, reshape3}, concat_axis); auto concat = make_shared<op::Concat>(NodeVector{reshape1, reshape2, reshape3}, concat_axis);
pass::Manager pass_manager; pass::Manager pass_manager;
pass_manager.register_pass<pass::VisualizeTree>("before.png");
pass_manager.register_pass<pass::AlgebraicSimplification>(); pass_manager.register_pass<pass::AlgebraicSimplification>();
pass_manager.register_pass<pass::VisualizeTree>("after.png");
auto f = std::make_shared<Function>(ngraph::NodeVector{concat}, ParameterVector{a}); auto f = std::make_shared<Function>(ngraph::NodeVector{concat}, ParameterVector{a});
pass_manager.run_passes(f); pass_manager.run_passes(f);
...@@ -398,9 +396,7 @@ TEST(algebraic_simplification, concat_slice) ...@@ -398,9 +396,7 @@ TEST(algebraic_simplification, concat_slice)
auto concat = make_shared<op::Concat>(NodeVector{slice1, slice2, slice3}, concat_axis); auto concat = make_shared<op::Concat>(NodeVector{slice1, slice2, slice3}, concat_axis);
pass::Manager pass_manager; pass::Manager pass_manager;
pass_manager.register_pass<pass::VisualizeTree>("before.png");
pass_manager.register_pass<pass::AlgebraicSimplification>(); pass_manager.register_pass<pass::AlgebraicSimplification>();
pass_manager.register_pass<pass::VisualizeTree>("after.png");
auto f = std::make_shared<Function>(ngraph::NodeVector{concat}, ParameterVector{a}); auto f = std::make_shared<Function>(ngraph::NodeVector{concat}, ParameterVector{a});
pass_manager.run_passes(f); pass_manager.run_passes(f);
...@@ -418,9 +414,7 @@ TEST(algebraic_simplification, concat_parameter_slice) ...@@ -418,9 +414,7 @@ TEST(algebraic_simplification, concat_parameter_slice)
auto concat = make_shared<op::Concat>(NodeVector{slice1, slice2, slice3}, concat_axis); auto concat = make_shared<op::Concat>(NodeVector{slice1, slice2, slice3}, concat_axis);
pass::Manager pass_manager; pass::Manager pass_manager;
pass_manager.register_pass<pass::VisualizeTree>("before.png");
pass_manager.register_pass<pass::AlgebraicSimplification>(); pass_manager.register_pass<pass::AlgebraicSimplification>();
pass_manager.register_pass<pass::VisualizeTree>("after.png");
auto f = std::make_shared<Function>(ngraph::NodeVector{concat}, ParameterVector{a}); auto f = std::make_shared<Function>(ngraph::NodeVector{concat}, ParameterVector{a});
pass_manager.run_passes(f); pass_manager.run_passes(f);
...@@ -438,9 +432,7 @@ TEST(algebraic_simplification, concat_parameter_slices_reversed) ...@@ -438,9 +432,7 @@ TEST(algebraic_simplification, concat_parameter_slices_reversed)
auto concat = make_shared<op::Concat>(NodeVector{slice3, slice2, slice1}, concat_axis); auto concat = make_shared<op::Concat>(NodeVector{slice3, slice2, slice1}, concat_axis);
pass::Manager pass_manager; pass::Manager pass_manager;
pass_manager.register_pass<pass::VisualizeTree>("before.png");
pass_manager.register_pass<pass::AlgebraicSimplification>(); pass_manager.register_pass<pass::AlgebraicSimplification>();
pass_manager.register_pass<pass::VisualizeTree>("after.png");
auto f = std::make_shared<Function>(ngraph::NodeVector{concat}, ParameterVector{a}); auto f = std::make_shared<Function>(ngraph::NodeVector{concat}, ParameterVector{a});
pass_manager.run_passes(f); pass_manager.run_passes(f);
...@@ -459,9 +451,7 @@ TEST(algebraic_simplification, concat_parameter_slices_element_count) ...@@ -459,9 +451,7 @@ TEST(algebraic_simplification, concat_parameter_slices_element_count)
auto concat = make_shared<op::Concat>(NodeVector{slice1, slice2, slice3}, concat_axis); auto concat = make_shared<op::Concat>(NodeVector{slice1, slice2, slice3}, concat_axis);
pass::Manager pass_manager; pass::Manager pass_manager;
pass_manager.register_pass<pass::VisualizeTree>("before.png");
pass_manager.register_pass<pass::AlgebraicSimplification>(); pass_manager.register_pass<pass::AlgebraicSimplification>();
pass_manager.register_pass<pass::VisualizeTree>("after.png");
auto f = std::make_shared<Function>(ngraph::NodeVector{concat}, ParameterVector{a}); auto f = std::make_shared<Function>(ngraph::NodeVector{concat}, ParameterVector{a});
pass_manager.run_passes(f); pass_manager.run_passes(f);
...@@ -479,9 +469,7 @@ TEST(algebraic_simplification, concat_parameter_non_uniform_slices) ...@@ -479,9 +469,7 @@ TEST(algebraic_simplification, concat_parameter_non_uniform_slices)
auto concat = make_shared<op::Concat>(NodeVector{slice1, slice2, slice3}, concat_axis); auto concat = make_shared<op::Concat>(NodeVector{slice1, slice2, slice3}, concat_axis);
pass::Manager pass_manager; pass::Manager pass_manager;
pass_manager.register_pass<pass::VisualizeTree>("before.png");
pass_manager.register_pass<pass::AlgebraicSimplification>(); pass_manager.register_pass<pass::AlgebraicSimplification>();
pass_manager.register_pass<pass::VisualizeTree>("after.png");
auto f = std::make_shared<Function>(ngraph::NodeVector{concat}, ParameterVector{a}); auto f = std::make_shared<Function>(ngraph::NodeVector{concat}, ParameterVector{a});
pass_manager.run_passes(f); pass_manager.run_passes(f);
...@@ -504,9 +492,7 @@ TEST(algebraic_simplification, concat_different_goes) ...@@ -504,9 +492,7 @@ TEST(algebraic_simplification, concat_different_goes)
auto concat = make_shared<op::Concat>(NodeVector{slice1, slice2, slice3}, concat_axis); auto concat = make_shared<op::Concat>(NodeVector{slice1, slice2, slice3}, concat_axis);
pass::Manager pass_manager; pass::Manager pass_manager;
pass_manager.register_pass<pass::VisualizeTree>("before.png");
pass_manager.register_pass<pass::AlgebraicSimplification>(); pass_manager.register_pass<pass::AlgebraicSimplification>();
pass_manager.register_pass<pass::VisualizeTree>("after.png");
auto f = std::make_shared<Function>(ngraph::NodeVector{concat}, ParameterVector{a}); auto f = std::make_shared<Function>(ngraph::NodeVector{concat}, ParameterVector{a});
pass_manager.run_passes(f); pass_manager.run_passes(f);
......
...@@ -77,13 +77,12 @@ TEST(backend_api, save_load) ...@@ -77,13 +77,12 @@ TEST(backend_api, save_load)
copy_data<float>(a, {1.f, 2.f, 3.f, 4.f}); copy_data<float>(a, {1.f, 2.f, 3.f, 4.f});
copy_data<float>(b, {5.f, 6.f, 7.f, 8.f}); copy_data<float>(b, {5.f, 6.f, 7.f, 8.f});
stringstream file;
{ {
ofstream file("test.interpreter_save");
auto handle = backend->compile(f); auto handle = backend->compile(f);
handle->save(file); handle->save(file);
} }
{ {
ifstream file("test.interpreter_save");
auto handle = backend->load(file); auto handle = backend->load(file);
ASSERT_NE(handle, nullptr); ASSERT_NE(handle, nullptr);
handle->call_with_validate({result}, {a, b}); handle->call_with_validate({result}, {a, b});
......
...@@ -1457,27 +1457,13 @@ TEST(cpu_fusion, max_pool_with_indices) ...@@ -1457,27 +1457,13 @@ TEST(cpu_fusion, max_pool_with_indices)
auto f = std::make_shared<Function>(NodeVector{max_pool}, ParameterVector{input}); auto f = std::make_shared<Function>(NodeVector{max_pool}, ParameterVector{input});
{
pass::Manager pass_manager;
pass_manager.register_pass<pass::VisualizeTree>("max_pool_fprop_before.png");
pass_manager.run_passes(f);
}
{ {
NodeVector nv_cwi; NodeVector nv_cwi;
pass::Manager pass_manager; pass::Manager pass_manager;
pass_manager.register_pass<pass::VisualizeTree>("max_pool_bprop_before.png");
pass_manager.register_pass<runtime::cpu::pass::CPUWorkspaceInsertion>(nv_cwi); pass_manager.register_pass<runtime::cpu::pass::CPUWorkspaceInsertion>(nv_cwi);
pass_manager.register_pass<pass::VisualizeTree>("max_pool_bprop_after.png");
pass_manager.run_passes(df); pass_manager.run_passes(df);
} }
{
pass::Manager pass_manager;
pass_manager.register_pass<pass::VisualizeTree>("max_pool_fprop_after.png");
pass_manager.run_passes(f);
}
auto maxpool_goe_output = auto maxpool_goe_output =
as_type_ptr<op::GetOutputElement>(f->get_results().at(0)->get_argument(0)); as_type_ptr<op::GetOutputElement>(f->get_results().at(0)->get_argument(0));
ASSERT_TRUE(maxpool_goe_output); ASSERT_TRUE(maxpool_goe_output);
......
...@@ -35,19 +35,6 @@ ...@@ -35,19 +35,6 @@
using namespace ngraph; using namespace ngraph;
using namespace std; using namespace std;
TEST(pass, visualize_tree)
{
Shape shape{2, 2};
auto A = make_shared<op::Parameter>(element::f32, shape);
auto B = make_shared<op::Parameter>(element::f32, shape);
auto C = make_shared<op::Parameter>(element::f32, shape);
auto f = make_shared<Function>((A + B) * C, ParameterVector{A, B, C});
ngraph::pass::Manager pm;
pm.register_pass<pass::VisualizeTree>("test_viz.png");
pm.run_passes(f);
}
TEST(pass, constant_to_broadcast) TEST(pass, constant_to_broadcast)
{ {
Shape shape{128, 256, 1, 1}; Shape shape{128, 256, 1, 1};
...@@ -55,11 +42,6 @@ TEST(pass, constant_to_broadcast) ...@@ -55,11 +42,6 @@ TEST(pass, constant_to_broadcast)
auto c = make_shared<op::Constant>(element::f32, shape, v); auto c = make_shared<op::Constant>(element::f32, shape, v);
auto f = make_shared<Function>(c, ParameterVector{}); auto f = make_shared<Function>(c, ParameterVector{});
{
ngraph::pass::Manager pm;
pm.register_pass<pass::VisualizeTree>("pre_constant_to_broadcast.png");
pm.run_passes(f);
}
{ {
ngraph::pass::Manager pm; ngraph::pass::Manager pm;
pm.register_pass<pass::ConstantToBroadcast>(); pm.register_pass<pass::ConstantToBroadcast>();
...@@ -67,9 +49,4 @@ TEST(pass, constant_to_broadcast) ...@@ -67,9 +49,4 @@ TEST(pass, constant_to_broadcast)
pm.run_passes(f); pm.run_passes(f);
EXPECT_EQ(count_ops_of_type<op::Broadcast>(f), 1); EXPECT_EQ(count_ops_of_type<op::Broadcast>(f), 1);
} }
{
ngraph::pass::Manager pm;
pm.register_pass<pass::VisualizeTree>("post_constant_to_broadcast.png");
pm.run_passes(f);
}
} }
...@@ -206,11 +206,9 @@ TEST(memory_manager, memory_align) ...@@ -206,11 +206,9 @@ TEST(memory_manager, memory_align)
TEST(memory_layout, basic) TEST(memory_layout, basic)
{ {
string dump_file = "memory_layout.txt";
pass::Manager pass_manager; pass::Manager pass_manager;
pass_manager.register_pass<pass::Liveness>(); pass_manager.register_pass<pass::Liveness>();
pass_manager.register_pass<pass::MemoryLayout>(); pass_manager.register_pass<pass::MemoryLayout>();
pass_manager.register_pass<pass::DumpSorted>(dump_file);
auto graph = make_test_graph(); auto graph = make_test_graph();
pass_manager.run_passes(graph); pass_manager.run_passes(graph);
...@@ -221,11 +219,9 @@ TEST(memory_layout, basic) ...@@ -221,11 +219,9 @@ TEST(memory_layout, basic)
TEST(memory_layout, constant) TEST(memory_layout, constant)
{ {
string dump_file = "constant.txt";
pass::Manager pass_manager; pass::Manager pass_manager;
pass_manager.register_pass<pass::Liveness>(); pass_manager.register_pass<pass::Liveness>();
pass_manager.register_pass<pass::MemoryLayout>(); pass_manager.register_pass<pass::MemoryLayout>();
pass_manager.register_pass<pass::DumpSorted>(dump_file);
Shape shape{1}; Shape shape{1};
auto c = op::Constant::create(element::i32, shape, {5}); auto c = op::Constant::create(element::i32, shape, {5});
......
...@@ -60,11 +60,9 @@ TEST(reshape_sinking, edge_splitting) ...@@ -60,11 +60,9 @@ TEST(reshape_sinking, edge_splitting)
auto func = make_shared<Function>(NodeVector{absn2, sum}, ParameterVector{a}); auto func = make_shared<Function>(NodeVector{absn2, sum}, ParameterVector{a});
pass::Manager pass_manager; pass::Manager pass_manager;
// size_t before_count = count_ops_of_type<op::Reshape>(func); // size_t before_count = count_ops_of_type<op::Reshape>(func);
pass_manager.register_pass<pass::VisualizeTree>("before.png");
pass_manager.register_pass<pass::ReshapeSinking>(); pass_manager.register_pass<pass::ReshapeSinking>();
pass_manager.register_pass<pass::ReshapeElimination>(); pass_manager.register_pass<pass::ReshapeElimination>();
pass_manager.register_pass<pass::CommonSubexpressionElimination>(); pass_manager.register_pass<pass::CommonSubexpressionElimination>();
pass_manager.register_pass<pass::VisualizeTree>("after.png");
pass_manager.run_passes(func); pass_manager.run_passes(func);
ASSERT_EQ(func->get_results().at(1)->get_argument(0), sum); ASSERT_EQ(func->get_results().at(1)->get_argument(0), sum);
auto new_reshape = as_type_ptr<op::Reshape>(func->get_results().at(0)->get_argument(0)); auto new_reshape = as_type_ptr<op::Reshape>(func->get_results().at(0)->get_argument(0));
...@@ -118,13 +116,11 @@ TEST(reshape_sinking, mnist_conv) ...@@ -118,13 +116,11 @@ TEST(reshape_sinking, mnist_conv)
shared_ptr<Function> func = ngraph::deserialize(ss); shared_ptr<Function> func = ngraph::deserialize(ss);
pass::Manager pass_manager; pass::Manager pass_manager;
size_t before_count = count_ops_of_type<op::Reshape>(func); size_t before_count = count_ops_of_type<op::Reshape>(func);
// pass_manager.register_pass<pass::VisualizeTree>("before.png");
pass_manager.register_pass<pass::ReshapeSinking>(); pass_manager.register_pass<pass::ReshapeSinking>();
pass_manager.register_pass<pass::ReshapeElimination>(); pass_manager.register_pass<pass::ReshapeElimination>();
pass_manager.register_pass<pass::CommonSubexpressionElimination>(); pass_manager.register_pass<pass::CommonSubexpressionElimination>();
// pass_manager.register_pass<pass::CoreFusion>(); // pass_manager.register_pass<pass::CoreFusion>();
// pass_manager.register_pass<runtime::cpu::pass::CPUFusion>(); // pass_manager.register_pass<runtime::cpu::pass::CPUFusion>();
// pass_manager.register_pass<pass::VisualizeTree>("after.png");
pass_manager.run_passes(func); pass_manager.run_passes(func);
size_t before_after = count_ops_of_type<op::Reshape>(func); size_t before_after = count_ops_of_type<op::Reshape>(func);
ASSERT_LE(before_after, before_count); ASSERT_LE(before_after, before_count);
...@@ -154,11 +150,9 @@ TEST(reshape_sinking, nasnet_pooladd) ...@@ -154,11 +150,9 @@ TEST(reshape_sinking, nasnet_pooladd)
pass::Manager pass_manager; pass::Manager pass_manager;
size_t before_count = count_ops_of_type<op::Reshape>(func); size_t before_count = count_ops_of_type<op::Reshape>(func);
pass_manager.register_pass<pass::VisualizeTree>("before.png");
pass_manager.register_pass<pass::ReshapeSinking>(); pass_manager.register_pass<pass::ReshapeSinking>();
pass_manager.register_pass<pass::ReshapeElimination>(); pass_manager.register_pass<pass::ReshapeElimination>();
pass_manager.register_pass<pass::CommonSubexpressionElimination>(); pass_manager.register_pass<pass::CommonSubexpressionElimination>();
pass_manager.register_pass<pass::VisualizeTree>("after.png");
pass_manager.run_passes(func); pass_manager.run_passes(func);
size_t before_after = count_ops_of_type<op::Reshape>(func); size_t before_after = count_ops_of_type<op::Reshape>(func);
ASSERT_LE(before_after, before_count); ASSERT_LE(before_after, before_count);
...@@ -192,11 +186,9 @@ TEST(reshape_sinking, slice_pad) ...@@ -192,11 +186,9 @@ TEST(reshape_sinking, slice_pad)
pass::Manager pass_manager; pass::Manager pass_manager;
size_t before_count = count_ops_of_type<op::Reshape>(f); size_t before_count = count_ops_of_type<op::Reshape>(f);
pass_manager.register_pass<pass::VisualizeTree>("before.png");
pass_manager.register_pass<pass::ReshapeSinking>(); pass_manager.register_pass<pass::ReshapeSinking>();
pass_manager.register_pass<pass::ReshapeElimination>(); pass_manager.register_pass<pass::ReshapeElimination>();
pass_manager.register_pass<pass::CommonSubexpressionElimination>(); pass_manager.register_pass<pass::CommonSubexpressionElimination>();
pass_manager.register_pass<pass::VisualizeTree>("after.png");
pass_manager.run_passes(f); pass_manager.run_passes(f);
size_t before_after = count_ops_of_type<op::Reshape>(f); size_t before_after = count_ops_of_type<op::Reshape>(f);
ASSERT_LE(before_after, before_count); ASSERT_LE(before_after, before_count);
...@@ -265,11 +257,9 @@ TEST(reshape_sinking, concat) ...@@ -265,11 +257,9 @@ TEST(reshape_sinking, concat)
auto f = make_shared<Function>(reshape_conv2, ParameterVector{A_, A1_}); auto f = make_shared<Function>(reshape_conv2, ParameterVector{A_, A1_});
pass::Manager pass_manager; pass::Manager pass_manager;
size_t before_count = count_ops_of_type<op::Reshape>(f); size_t before_count = count_ops_of_type<op::Reshape>(f);
pass_manager.register_pass<pass::VisualizeTree>("before.png");
pass_manager.register_pass<pass::ReshapeSinking>(); pass_manager.register_pass<pass::ReshapeSinking>();
pass_manager.register_pass<pass::ReshapeElimination>(); pass_manager.register_pass<pass::ReshapeElimination>();
pass_manager.register_pass<pass::CommonSubexpressionElimination>(); pass_manager.register_pass<pass::CommonSubexpressionElimination>();
pass_manager.register_pass<pass::VisualizeTree>("after.png");
pass_manager.run_passes(f); pass_manager.run_passes(f);
size_t before_after = count_ops_of_type<op::Reshape>(f); size_t before_after = count_ops_of_type<op::Reshape>(f);
ASSERT_LE(before_after, before_count); ASSERT_LE(before_after, before_count);
......
...@@ -47,9 +47,7 @@ TEST(zero_dim_tensor_elimination, zero_sum) ...@@ -47,9 +47,7 @@ TEST(zero_dim_tensor_elimination, zero_sum)
auto f = std::make_shared<Function>(NodeVector{sum_node, constant}, ParameterVector{A}); auto f = std::make_shared<Function>(NodeVector{sum_node, constant}, ParameterVector{A});
pass::Manager pass_manager; pass::Manager pass_manager;
pass_manager.register_pass<pass::VisualizeTree>("zero_sum_before.png");
pass_manager.register_pass<ngraph::pass::ZeroDimTensorElimination>(); pass_manager.register_pass<ngraph::pass::ZeroDimTensorElimination>();
pass_manager.register_pass<pass::VisualizeTree>("zero_sum_after.png");
EXPECT_EQ(count_ops_of_type<op::Sum>(f), 1); EXPECT_EQ(count_ops_of_type<op::Sum>(f), 1);
pass_manager.run_passes(f); pass_manager.run_passes(f);
EXPECT_EQ(count_ops_of_type<op::Sum>(f), 0); EXPECT_EQ(count_ops_of_type<op::Sum>(f), 0);
...@@ -65,9 +63,7 @@ TEST(zero_dim_tensor_elimination, zero_product) ...@@ -65,9 +63,7 @@ TEST(zero_dim_tensor_elimination, zero_product)
auto f = std::make_shared<Function>(NodeVector{product_node, constant}, ParameterVector{A}); auto f = std::make_shared<Function>(NodeVector{product_node, constant}, ParameterVector{A});
pass::Manager pass_manager; pass::Manager pass_manager;
pass_manager.register_pass<pass::VisualizeTree>("zero_product_before.png");
pass_manager.register_pass<ngraph::pass::ZeroDimTensorElimination>(); pass_manager.register_pass<ngraph::pass::ZeroDimTensorElimination>();
pass_manager.register_pass<pass::VisualizeTree>("zero_product_after.png");
EXPECT_EQ(count_ops_of_type<op::Product>(f), 1); EXPECT_EQ(count_ops_of_type<op::Product>(f), 1);
pass_manager.run_passes(f); pass_manager.run_passes(f);
EXPECT_EQ(count_ops_of_type<op::Product>(f), 0); EXPECT_EQ(count_ops_of_type<op::Product>(f), 0);
...@@ -83,9 +79,7 @@ TEST(zero_dim_tensor_elimination, zero_min) ...@@ -83,9 +79,7 @@ TEST(zero_dim_tensor_elimination, zero_min)
auto f = std::make_shared<Function>(NodeVector{min_node, constant}, ParameterVector{A}); auto f = std::make_shared<Function>(NodeVector{min_node, constant}, ParameterVector{A});
pass::Manager pass_manager; pass::Manager pass_manager;
pass_manager.register_pass<pass::VisualizeTree>("zero_min_before.png");
pass_manager.register_pass<ngraph::pass::ZeroDimTensorElimination>(); pass_manager.register_pass<ngraph::pass::ZeroDimTensorElimination>();
pass_manager.register_pass<pass::VisualizeTree>("zero_min_after.png");
EXPECT_EQ(count_ops_of_type<op::Min>(f), 1); EXPECT_EQ(count_ops_of_type<op::Min>(f), 1);
pass_manager.run_passes(f); pass_manager.run_passes(f);
EXPECT_EQ(count_ops_of_type<op::Min>(f), 0); EXPECT_EQ(count_ops_of_type<op::Min>(f), 0);
...@@ -101,9 +95,7 @@ TEST(zero_dim_tensor_elimination, zero_max) ...@@ -101,9 +95,7 @@ TEST(zero_dim_tensor_elimination, zero_max)
auto f = std::make_shared<Function>(NodeVector{max_node, constant}, ParameterVector{A}); auto f = std::make_shared<Function>(NodeVector{max_node, constant}, ParameterVector{A});
pass::Manager pass_manager; pass::Manager pass_manager;
pass_manager.register_pass<pass::VisualizeTree>("zero_max_before.png");
pass_manager.register_pass<ngraph::pass::ZeroDimTensorElimination>(); pass_manager.register_pass<ngraph::pass::ZeroDimTensorElimination>();
pass_manager.register_pass<pass::VisualizeTree>("zero_max_after.png");
EXPECT_EQ(count_ops_of_type<op::Max>(f), 1); EXPECT_EQ(count_ops_of_type<op::Max>(f), 1);
pass_manager.run_passes(f); pass_manager.run_passes(f);
EXPECT_EQ(count_ops_of_type<op::Max>(f), 0); EXPECT_EQ(count_ops_of_type<op::Max>(f), 0);
...@@ -122,9 +114,7 @@ TEST(zero_dim_tensor_elimination, zero_const_conv) ...@@ -122,9 +114,7 @@ TEST(zero_dim_tensor_elimination, zero_const_conv)
std::make_shared<Function>(NodeVector{abs_node, constant}, ParameterVector{A, weights}); std::make_shared<Function>(NodeVector{abs_node, constant}, ParameterVector{A, weights});
pass::Manager pass_manager; pass::Manager pass_manager;
pass_manager.register_pass<pass::VisualizeTree>("zero_const_conv_before.png");
pass_manager.register_pass<ngraph::pass::ZeroDimTensorElimination>(); pass_manager.register_pass<ngraph::pass::ZeroDimTensorElimination>();
pass_manager.register_pass<pass::VisualizeTree>("zero_const_conv_after.png");
EXPECT_EQ(count_ops_of_type<op::Convolution>(f), 1); EXPECT_EQ(count_ops_of_type<op::Convolution>(f), 1);
pass_manager.run_passes(f); pass_manager.run_passes(f);
EXPECT_EQ(count_ops_of_type<op::Convolution>(f), 0); EXPECT_EQ(count_ops_of_type<op::Convolution>(f), 0);
...@@ -142,9 +132,7 @@ TEST(zero_dim_tensor_elimination, zero_const_avg_pool) ...@@ -142,9 +132,7 @@ TEST(zero_dim_tensor_elimination, zero_const_avg_pool)
auto f = std::make_shared<Function>(NodeVector{abs_node, constant}, ParameterVector{A}); auto f = std::make_shared<Function>(NodeVector{abs_node, constant}, ParameterVector{A});
pass::Manager pass_manager; pass::Manager pass_manager;
pass_manager.register_pass<pass::VisualizeTree>("zero_const_avg_pool_before.png");
pass_manager.register_pass<ngraph::pass::ZeroDimTensorElimination>(); pass_manager.register_pass<ngraph::pass::ZeroDimTensorElimination>();
pass_manager.register_pass<pass::VisualizeTree>("zero_const_avg_pool_after.png");
EXPECT_EQ(count_ops_of_type<op::AvgPool>(f), 1); EXPECT_EQ(count_ops_of_type<op::AvgPool>(f), 1);
pass_manager.run_passes(f); pass_manager.run_passes(f);
EXPECT_EQ(count_ops_of_type<op::AvgPool>(f), 0); EXPECT_EQ(count_ops_of_type<op::AvgPool>(f), 0);
...@@ -162,9 +150,7 @@ TEST(zero_dim_tensor_elimination, zero_const_pad) ...@@ -162,9 +150,7 @@ TEST(zero_dim_tensor_elimination, zero_const_pad)
auto f = std::make_shared<Function>(NodeVector{abs_node, constant}, ParameterVector{A, B}); auto f = std::make_shared<Function>(NodeVector{abs_node, constant}, ParameterVector{A, B});
pass::Manager pass_manager; pass::Manager pass_manager;
pass_manager.register_pass<pass::VisualizeTree>("zero_const_pad_before.png");
pass_manager.register_pass<ngraph::pass::ZeroDimTensorElimination>(); pass_manager.register_pass<ngraph::pass::ZeroDimTensorElimination>();
pass_manager.register_pass<pass::VisualizeTree>("zero_const_pad_after.png");
EXPECT_EQ(count_ops_of_type<op::Broadcast>(f), 0); EXPECT_EQ(count_ops_of_type<op::Broadcast>(f), 0);
pass_manager.run_passes(f); pass_manager.run_passes(f);
EXPECT_EQ(count_ops_of_type<op::Broadcast>(f), 1); EXPECT_EQ(count_ops_of_type<op::Broadcast>(f), 1);
...@@ -182,9 +168,7 @@ TEST(zero_dim_tensor_elimination, zero_const_slice) ...@@ -182,9 +168,7 @@ TEST(zero_dim_tensor_elimination, zero_const_slice)
auto f = std::make_shared<Function>(NodeVector{abs_node, constant}, ParameterVector{A, B}); auto f = std::make_shared<Function>(NodeVector{abs_node, constant}, ParameterVector{A, B});
pass::Manager pass_manager; pass::Manager pass_manager;
pass_manager.register_pass<pass::VisualizeTree>("zero_const_slice_before.png");
pass_manager.register_pass<ngraph::pass::ZeroDimTensorElimination>(); pass_manager.register_pass<ngraph::pass::ZeroDimTensorElimination>();
pass_manager.register_pass<pass::VisualizeTree>("zero_const_slice_after.png");
EXPECT_EQ(count_ops_of_type<op::Broadcast>(f), 0); EXPECT_EQ(count_ops_of_type<op::Broadcast>(f), 0);
EXPECT_EQ(count_ops_of_type<op::Slice>(f), 0); EXPECT_EQ(count_ops_of_type<op::Slice>(f), 0);
pass_manager.run_passes(f); pass_manager.run_passes(f);
...@@ -199,9 +183,7 @@ TEST(zero_dim_tensor_elimination, zero_argmax) ...@@ -199,9 +183,7 @@ TEST(zero_dim_tensor_elimination, zero_argmax)
auto f = std::make_shared<Function>(NodeVector{argmax}, ParameterVector{A}); auto f = std::make_shared<Function>(NodeVector{argmax}, ParameterVector{A});
pass::Manager pass_manager; pass::Manager pass_manager;
pass_manager.register_pass<pass::VisualizeTree>("zero_argmax_before.png");
pass_manager.register_pass<ngraph::pass::ZeroDimTensorElimination>(); pass_manager.register_pass<ngraph::pass::ZeroDimTensorElimination>();
pass_manager.register_pass<pass::VisualizeTree>("zero_argmax_after.png");
EXPECT_EQ(count_ops_of_type<op::ArgMax>(f), 1); EXPECT_EQ(count_ops_of_type<op::ArgMax>(f), 1);
pass_manager.run_passes(f); pass_manager.run_passes(f);
EXPECT_EQ(count_ops_of_type<op::ArgMax>(f), 0); EXPECT_EQ(count_ops_of_type<op::ArgMax>(f), 0);
...@@ -215,9 +197,7 @@ TEST(zero_dim_tensor_elimination, zero_argmin) ...@@ -215,9 +197,7 @@ TEST(zero_dim_tensor_elimination, zero_argmin)
auto f = std::make_shared<Function>(NodeVector{argmin}, ParameterVector{A}); auto f = std::make_shared<Function>(NodeVector{argmin}, ParameterVector{A});
pass::Manager pass_manager; pass::Manager pass_manager;
pass_manager.register_pass<pass::VisualizeTree>("zero_argmin_before.png");
pass_manager.register_pass<ngraph::pass::ZeroDimTensorElimination>(); pass_manager.register_pass<ngraph::pass::ZeroDimTensorElimination>();
pass_manager.register_pass<pass::VisualizeTree>("zero_argmin_after.png");
EXPECT_EQ(count_ops_of_type<op::ArgMin>(f), 1); EXPECT_EQ(count_ops_of_type<op::ArgMin>(f), 1);
pass_manager.run_passes(f); pass_manager.run_passes(f);
EXPECT_EQ(count_ops_of_type<op::ArgMin>(f), 0); EXPECT_EQ(count_ops_of_type<op::ArgMin>(f), 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment