From f69f6b698b17c5e87b8315605a6dbaf3f860e556 Mon Sep 17 00:00:00 2001 From: co63oc Date: Mon, 15 Jan 2024 21:30:59 +0800 Subject: [PATCH] Fix --- .../fleet/meta_optimizers/raw_program_optimizer.py | 6 +++--- test/ir/pir/fused_pass/test_fused_dropout_add_pass.py | 4 ++-- .../ir/pir/fused_pass/test_fused_gemm_epilogue_pass.py | 4 ++-- .../test_pir_fc_elementwise_layernorm_fuse_pass.py | 2 +- test/ir/pir/test_pass_manager.py | 4 ++-- test/ir/pir/test_pir_identity_op_clean_pass.py | 10 +++++----- test/ir/pir/test_pir_to_static.py | 2 +- test/ir/pir/test_standalone_pir.py | 2 +- test/ir/pir/test_stop_gradient.py | 2 +- test/ir/pir/test_while_api.py | 2 +- 10 files changed, 19 insertions(+), 19 deletions(-) diff --git a/python/paddle/distributed/fleet/meta_optimizers/raw_program_optimizer.py b/python/paddle/distributed/fleet/meta_optimizers/raw_program_optimizer.py index 36061659c9cef4..6a6ae57cc55e78 100755 --- a/python/paddle/distributed/fleet/meta_optimizers/raw_program_optimizer.py +++ b/python/paddle/distributed/fleet/meta_optimizers/raw_program_optimizer.py @@ -379,7 +379,7 @@ def _allreduce_fusion_program(self): continue param_grads.append((param, grad)) - outputs_name_to_idx = self.__get_ouputs_name_to_idx( + outputs_name_to_idx = self.__get_outputs_name_to_idx( first_backward_idx, block ) @@ -476,7 +476,7 @@ def get_after_idx_of_fuse_group(grad_param_segments): idx += 1 # update the outputs_name_to_idx after insertion of sync/allreduce ops - outputs_name_to_idx = self.__get_ouputs_name_to_idx( + outputs_name_to_idx = self.__get_outputs_name_to_idx( first_backward_idx, block ) # the before_idx is not guaranteed sorted, therefore we have to find the @@ -530,7 +530,7 @@ def get_after_idx_of_fuse_group(grad_param_segments): break block._sync_with_cpp() - def __get_ouputs_name_to_idx(self, first_backward_idx, block): + def __get_outputs_name_to_idx(self, first_backward_idx, block): # Each item of outputs_name_to_idx is a pair of idx. # The first entry of this pair is the idx of the first op generates the grad, # which is used to indicate the position to insert coalesce op. diff --git a/test/ir/pir/fused_pass/test_fused_dropout_add_pass.py b/test/ir/pir/fused_pass/test_fused_dropout_add_pass.py index af413d0e2096e7..373047d993e887 100644 --- a/test/ir/pir/fused_pass/test_fused_dropout_add_pass.py +++ b/test/ir/pir/fused_pass/test_fused_dropout_add_pass.py @@ -42,7 +42,7 @@ def _test_fused_dropout_add(self): pm = paddle.pir.PassManager() pm.add_pass( 'fused_dropout_add_pass' - ) # apply pass to elimitate dead code + ) # apply pass to eliminate dead code pm.run(main_program) op_names = [op.name() for op in main_program.global_block().ops] self.assertTrue('pd_op.fused_dropout_add' in op_names) @@ -91,7 +91,7 @@ def test_fused_dropout_add_grad(self): pm = paddle.pir.PassManager() pm.add_pass( 'fused_dropout_add_pass' - ) # apply pass to elimitate dead code + ) # apply pass to eliminate dead code pm.run(main_program) op_names = [op.name() for op in main_program.global_block().ops] self.assertTrue( diff --git a/test/ir/pir/fused_pass/test_fused_gemm_epilogue_pass.py b/test/ir/pir/fused_pass/test_fused_gemm_epilogue_pass.py index a3aa6a4458b967..a7d836e61e6404 100644 --- a/test/ir/pir/fused_pass/test_fused_gemm_epilogue_pass.py +++ b/test/ir/pir/fused_pass/test_fused_gemm_epilogue_pass.py @@ -42,7 +42,7 @@ def get_cuda_version(): not core.is_compiled_with_cuda() or get_cuda_version() < 11060, "core is not complied with CUDA or nvcc version is less than11.6", ) -class TestFusedgemm_epilogueAdd(unittest.TestCase): +class TestFusedGemm_epilogueAdd(unittest.TestCase): def test_fused_gemm_epilogue_add(self): with paddle.pir_utils.IrGuard(): x_np = np.random.normal(3, 2.5, size=(1024, 1024)).astype( @@ -94,7 +94,7 @@ def test_fused_gemm_epilogue_add(self): pm = paddle.pir.PassManager() pm.add_pass( 'fused_gemm_epilogue_pass' - ) # apply pass to elimitate dead code + ) # apply pass to eliminate dead code pm.run(main_program) op_names = [op.name() for op in main_program.global_block().ops] self.assertTrue( diff --git a/test/ir/pir/fused_pass/test_pir_fc_elementwise_layernorm_fuse_pass.py b/test/ir/pir/fused_pass/test_pir_fc_elementwise_layernorm_fuse_pass.py index 6aaa3ee413fb09..405ba7e72c20ee 100644 --- a/test/ir/pir/fused_pass/test_pir_fc_elementwise_layernorm_fuse_pass.py +++ b/test/ir/pir/fused_pass/test_pir_fc_elementwise_layernorm_fuse_pass.py @@ -29,7 +29,7 @@ class TestFcElementwiseLayerNormFusePattern(PassTest): \ / Add | - LayerNrom + LayerNorm """ def is_program_valid(self, program=None): diff --git a/test/ir/pir/test_pass_manager.py b/test/ir/pir/test_pass_manager.py index b9ca872e92d34b..2ff9cb98aadfe9 100644 --- a/test/ir/pir/test_pass_manager.py +++ b/test/ir/pir/test_pass_manager.py @@ -52,7 +52,7 @@ def test_op(self): pm = pir.PassManager() pm.add_pass( 'dead_code_elimination_pass' - ) # apply pass to elimitate dead code + ) # apply pass to eliminate dead code pm.run(new_program) op_names = [op.name() for op in new_program.global_block().ops] # print(op_names) @@ -60,7 +60,7 @@ def test_op(self): self.assertFalse(pm.empty()) self.assertTrue( 'pd_op.uniform' not in op_names - ) # uniform is elimited because its output is not used + ) # uniform is eliminated because its output is not used if __name__ == "__main__": diff --git a/test/ir/pir/test_pir_identity_op_clean_pass.py b/test/ir/pir/test_pir_identity_op_clean_pass.py index d033f559164dbc..fdb9538b41c520 100644 --- a/test/ir/pir/test_pir_identity_op_clean_pass.py +++ b/test/ir/pir/test_pir_identity_op_clean_pass.py @@ -27,7 +27,7 @@ class TestRemoveUselessScalePattern(PassTest): def is_program_valid(self, program=None): return True - def build_ir_progam(self): + def build_ir_program(self): with paddle.pir_utils.IrGuard(): start_prog = paddle.static.Program() main_prog = paddle.static.Program() @@ -46,7 +46,7 @@ def build_ir_progam(self): return [main_prog, start_prog] def sample_program(self): - pir_program = self.build_ir_progam() + pir_program = self.build_ir_program() yield pir_program, False def test_check_output(self): @@ -58,7 +58,7 @@ def setUp(self): self.places.append(paddle.CUDAPlace(0)) -class TestRemoveRedundentScalePattern(PassTest): +class TestRemoveRedundantScalePattern(PassTest): def is_program_valid(self, program=None): return True @@ -169,7 +169,7 @@ def setUp(self): self.places.append(paddle.CUDAPlace(0)) -class TestRemoveRedundentCastPattern(PassTest): +class TestRemoveRedundantCastPattern(PassTest): def is_program_valid(self, program=None): return True @@ -204,7 +204,7 @@ def setUp(self): self.places.append(paddle.CUDAPlace(0)) -class TestRemoveRedundentTransposePattern(PassTest): +class TestRemoveRedundantTransposePattern(PassTest): def is_program_valid(self, program=None): return True diff --git a/test/ir/pir/test_pir_to_static.py b/test/ir/pir/test_pir_to_static.py index 82087ddbb6d480..9bfd5157c3fc67 100644 --- a/test/ir/pir/test_pir_to_static.py +++ b/test/ir/pir/test_pir_to_static.py @@ -54,7 +54,7 @@ def func(x): x_grad_ans = x.grad.numpy() x.clear_gradient() - # ==== to static compuatation ==== + # ==== to static computation ==== out = static_func(x) out = out * 2 out.backward() diff --git a/test/ir/pir/test_standalone_pir.py b/test/ir/pir/test_standalone_pir.py index 298e40b3299e1a..866a6fe105cc56 100644 --- a/test/ir/pir/test_standalone_pir.py +++ b/test/ir/pir/test_standalone_pir.py @@ -345,7 +345,7 @@ def func(x, y): np.testing.assert_array_equal(z.numpy(), gold_res) -# TODO(phlrain): open this after fix pr(55509) confict +# TODO(phlrain): open this after fix pr(55509) conflict # class TestPirLogicalDygraph(unittest.TestCase): # def test_with_pir(self): # paddle.disable_static() diff --git a/test/ir/pir/test_stop_gradient.py b/test/ir/pir/test_stop_gradient.py index 92c048dd30943d..6817e70a1d6751 100644 --- a/test/ir/pir/test_stop_gradient.py +++ b/test/ir/pir/test_stop_gradient.py @@ -41,7 +41,7 @@ def test_data(self): # TODO(Aurelius84): Add more test cases after API is migrated. -class TestParametes(unittest.TestCase): +class TestParameters(unittest.TestCase): def setUp(self): paddle.enable_static() diff --git a/test/ir/pir/test_while_api.py b/test/ir/pir/test_while_api.py index 337cf31970c1f6..c73e9706d3d0af 100644 --- a/test/ir/pir/test_while_api.py +++ b/test/ir/pir/test_while_api.py @@ -195,7 +195,7 @@ def test_backward(self): "pd_op.add_grad", ) - def test_backward_with_loop_var_same_to_extral_var(self): + def test_backward_with_loop_var_same_to_extra_var(self): main_program = paddle.static.Program() with paddle.pir.core.program_guard(main_program): i = paddle.full(shape=[1], fill_value=0)