From 40b686308676c0c05961971bb47b345543f10234 Mon Sep 17 00:00:00 2001 From: fuyou765 <64373205+fuyou765@users.noreply.github.com> Date: Tue, 12 Jul 2022 15:55:07 +0800 Subject: [PATCH] [MLU] fix expand_v2 scatter tile where ctest bugs (#44220) --- .../paddle/fluid/tests/unittests/mlu/test_expand_v2_op_mlu.py | 3 ++- python/paddle/fluid/tests/unittests/mlu/test_scatter_op_mlu.py | 3 ++- python/paddle/fluid/tests/unittests/mlu/test_tile_op_mlu.py | 3 ++- python/paddle/fluid/tests/unittests/mlu/test_where_op_mlu.py | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/python/paddle/fluid/tests/unittests/mlu/test_expand_v2_op_mlu.py b/python/paddle/fluid/tests/unittests/mlu/test_expand_v2_op_mlu.py index d7b1768d509..cbc99c2fa66 100644 --- a/python/paddle/fluid/tests/unittests/mlu/test_expand_v2_op_mlu.py +++ b/python/paddle/fluid/tests/unittests/mlu/test_expand_v2_op_mlu.py @@ -25,6 +25,8 @@ from paddle.fluid import compiler, Program, program_guard import paddle from paddle.fluid.framework import _test_eager_guard +paddle.enable_static() + # Situation 1: shape is a list(without tensor) class TestExpandV2OpRank1(OpTest): @@ -304,5 +306,4 @@ class TestExpandV2DygraphAPI(unittest.TestCase): if __name__ == "__main__": - paddle.enable_static() unittest.main() diff --git a/python/paddle/fluid/tests/unittests/mlu/test_scatter_op_mlu.py b/python/paddle/fluid/tests/unittests/mlu/test_scatter_op_mlu.py index 0725a27e512..d901813e348 100644 --- a/python/paddle/fluid/tests/unittests/mlu/test_scatter_op_mlu.py +++ b/python/paddle/fluid/tests/unittests/mlu/test_scatter_op_mlu.py @@ -25,6 +25,8 @@ from op_test import OpTest import paddle.fluid.core as core from paddle.fluid.dygraph.base import switch_to_static_graph +paddle.enable_static() + class TestScatterOp(OpTest): @@ -243,5 +245,4 @@ class TestScatterInplaceAPI(TestScatterAPI): if __name__ == "__main__": - paddle.enable_static() unittest.main() diff --git a/python/paddle/fluid/tests/unittests/mlu/test_tile_op_mlu.py b/python/paddle/fluid/tests/unittests/mlu/test_tile_op_mlu.py index 1a2f5dbd40e..7c1e227ba2c 100644 --- a/python/paddle/fluid/tests/unittests/mlu/test_tile_op_mlu.py +++ b/python/paddle/fluid/tests/unittests/mlu/test_tile_op_mlu.py @@ -24,6 +24,8 @@ import paddle import paddle.fluid as fluid from paddle.fluid import compiler, Program, program_guard +paddle.enable_static() + #Situation 1: repeat_times is a list (without tensor) class TestTileOpRank1(OpTest): @@ -277,5 +279,4 @@ class TestTileAPI(unittest.TestCase): if __name__ == "__main__": - paddle.enable_static() unittest.main() diff --git a/python/paddle/fluid/tests/unittests/mlu/test_where_op_mlu.py b/python/paddle/fluid/tests/unittests/mlu/test_where_op_mlu.py index 682a9e3909c..3f1d553f738 100644 --- a/python/paddle/fluid/tests/unittests/mlu/test_where_op_mlu.py +++ b/python/paddle/fluid/tests/unittests/mlu/test_where_op_mlu.py @@ -29,6 +29,8 @@ from paddle.fluid.op import Operator from paddle.fluid.backward import append_backward from paddle.fluid.framework import _test_eager_guard +paddle.enable_static() + class TestWhereOp(OpTest): @@ -396,5 +398,4 @@ class TestWhereOpError(unittest.TestCase): if __name__ == "__main__": - paddle.enable_static() unittest.main() -- GitLab