From 6b464f969a12ba84c542c9e73ad413873a5b07a1 Mon Sep 17 00:00:00 2001 From: Yiqun Liu Date: Tue, 19 May 2020 09:21:33 +0800 Subject: [PATCH] Add an operator node in unittest to make the fusing result unique. (#24617) --- paddle/fluid/framework/ir/fusion_group/fusion_group_pass.cc | 2 +- .../fluid/tests/unittests/ir/test_ir_fusion_group_pass.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/paddle/fluid/framework/ir/fusion_group/fusion_group_pass.cc b/paddle/fluid/framework/ir/fusion_group/fusion_group_pass.cc index 4dbb8ae4c6e..88334708592 100644 --- a/paddle/fluid/framework/ir/fusion_group/fusion_group_pass.cc +++ b/paddle/fluid/framework/ir/fusion_group/fusion_group_pass.cc @@ -82,7 +82,7 @@ int FusionGroupPass::DetectFusionGroup(Graph* graph, int type) const { bool FusionGroupPass::GenerateCode(fusion_group::SubGraph* subgraph) const { fusion_group::CodeGenerator code_generator; std::string code_str = code_generator.Generate(subgraph); - VLOG(3) << code_str; + VLOG(4) << code_str; // TODO(liuyiqun): supported different places platform::CUDAPlace place = platform::CUDAPlace(0); diff --git a/python/paddle/fluid/tests/unittests/ir/test_ir_fusion_group_pass.py b/python/paddle/fluid/tests/unittests/ir/test_ir_fusion_group_pass.py index 1957ad6e2b1..f00165f5e7e 100644 --- a/python/paddle/fluid/tests/unittests/ir/test_ir_fusion_group_pass.py +++ b/python/paddle/fluid/tests/unittests/ir/test_ir_fusion_group_pass.py @@ -122,7 +122,7 @@ class FusionGroupPassTestFP64(FusionGroupPassTest): self.fused_op_type = "fusion_group" -class FusionGroupPassTestFP16(FusionGroupPassTest): +class FusionGroupPassTestCastAndFP16(FusionGroupPassTest): def build_program(self, dtype): with fluid.program_guard(self.main_program, self.startup_program): self.feed_vars = self._prepare_feed_vars([32, 128], dtype, 2) @@ -132,7 +132,7 @@ class FusionGroupPassTestFP16(FusionGroupPassTest): # subgraph with 2 op nodes tmp_0 = self.feed_vars[0] * self.feed_vars[1] - tmp_1 = layers.cast(tmp_0, dtype="float16") + tmp_1 = layers.softmax(layers.cast(tmp_0, dtype="float16")) tmp_2 = layers.mul(tmp_0, self.feed_vars[2]) # subgraph with 4 op nodes tmp_3 = layers.cast(tmp_2, dtype="float16") @@ -141,7 +141,7 @@ class FusionGroupPassTestFP16(FusionGroupPassTest): self.append_gradients(tmp_5) - self.num_fused_ops = 3 + self.num_fused_ops = 4 self.fetch_list = [tmp_5, self.grad(tmp_0)] -- GitLab