From c4e8641340d244f004ba2d5e9759d8331cce5328 Mon Sep 17 00:00:00 2001 From: zhhsplendid Date: Mon, 13 Feb 2023 08:45:05 +0000 Subject: [PATCH 1/2] Enable Some Tests Which Were Disable Wrongly --- cinn/frontend/net_builder_test.cc | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/cinn/frontend/net_builder_test.cc b/cinn/frontend/net_builder_test.cc index afdcdf279b..43f253e442 100644 --- a/cinn/frontend/net_builder_test.cc +++ b/cinn/frontend/net_builder_test.cc @@ -232,7 +232,6 @@ TEST(net_build, program_execute_reverse) { runtime_program->Execute(); } -/* TEST(net_build, program_execute_clip) { const int M = 4; const int N = 3; @@ -243,18 +242,18 @@ TEST(net_build, program_execute_clip) { NetBuilder builder("net_builder"); Placeholder input = builder.CreateInput(Float(32), {M, N, K}, "In"); - //Variable output = builder.Clip({input}, max_val, min_val); + // Variable output = builder.Clip({input}, max_val, min_val); auto max_val_ = builder.FillConstant({M, N, K}, max_val, common::UniqName("constant")); auto min_val_ = builder.FillConstant({M, N, K}, min_val, common::UniqName("constant")); auto output_0 = builder.Min(input, max_val_); - auto output = builder.Max(output_0, min_val_); - auto program = builder.Build(); + auto output = builder.Max(output_0, min_val_); + auto program = builder.Build(); Target target = common::DefaultNVGPUTarget(); std::unordered_set fetch_ids; auto graph = Optimize(&program, fetch_ids, target); - LOG(INFO) <Visualize(); + LOG(INFO) << graph->Visualize(); auto scope = BuildScope(target, graph); hlir::framework::GraphCompiler gc(target, scope, graph); auto runtime_program = gc.Build(); @@ -495,7 +494,6 @@ TEST(net_build, program_execute_scatter) { } } - TEST(net_build, program_execute_scatter_nd) { const float default_value = 3.14; const int B = 3; @@ -1641,7 +1639,6 @@ TEST(net_build, program_execute_one_hot) { } } } -*/ } // namespace frontend } // namespace cinn From c8e1b93ca580341c7064bae884b7cda8fa53dc9e Mon Sep 17 00:00:00 2001 From: zhhsplendid Date: Mon, 13 Feb 2023 08:49:23 +0000 Subject: [PATCH 2/2] Correct clip test --- cinn/frontend/net_builder_test.cc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/cinn/frontend/net_builder_test.cc b/cinn/frontend/net_builder_test.cc index 43f253e442..d47acfa6dc 100644 --- a/cinn/frontend/net_builder_test.cc +++ b/cinn/frontend/net_builder_test.cc @@ -242,12 +242,8 @@ TEST(net_build, program_execute_clip) { NetBuilder builder("net_builder"); Placeholder input = builder.CreateInput(Float(32), {M, N, K}, "In"); - // Variable output = builder.Clip({input}, max_val, min_val); - auto max_val_ = builder.FillConstant({M, N, K}, max_val, common::UniqName("constant")); - auto min_val_ = builder.FillConstant({M, N, K}, min_val, common::UniqName("constant")); - auto output_0 = builder.Min(input, max_val_); - auto output = builder.Max(output_0, min_val_); - auto program = builder.Build(); + Variable output = builder.Clip({input}, max_val, min_val); + auto program = builder.Build(); Target target = common::DefaultNVGPUTarget(); std::unordered_set fetch_ids;