From 4eb3c61f216807ae336d70cd030c10a5b09bf92a Mon Sep 17 00:00:00 2001 From: Fisher Date: Mon, 29 May 2023 04:04:23 +0000 Subject: [PATCH 01/12] Enable check_cinn on atan2, tile, top_k and where --- .../paddle/fluid/tests/unittests/CMakeLists.txt | 5 ++++- .../fluid/tests/unittests/test_atan2_op.py | 13 +++++++++---- .../fluid/tests/unittests/test_tile_op.py | 17 +++++++++++------ .../fluid/tests/unittests/test_top_k_op.py | 5 +++-- .../fluid/tests/unittests/test_where_op.py | 10 ++++++---- 5 files changed, 33 insertions(+), 17 deletions(-) diff --git a/python/paddle/fluid/tests/unittests/CMakeLists.txt b/python/paddle/fluid/tests/unittests/CMakeLists.txt index d4c50707cbe78..f67fae46ed373 100755 --- a/python/paddle/fluid/tests/unittests/CMakeLists.txt +++ b/python/paddle/fluid/tests/unittests/CMakeLists.txt @@ -1124,7 +1124,10 @@ set(TEST_CINN_OPS test_lookup_table_op test_lookup_table_v2_op test_norm_op - test_one_hot_v2_op) + test_one_hot_v2_op + test_top_k_op + test_where_op + test_atan2_op) foreach(TEST_CINN_OPS ${TEST_CINN_OPS}) if(WITH_CINN) diff --git a/python/paddle/fluid/tests/unittests/test_atan2_op.py b/python/paddle/fluid/tests/unittests/test_atan2_op.py index 44ae2f9862f4a..37c577ef12ca4 100644 --- a/python/paddle/fluid/tests/unittests/test_atan2_op.py +++ b/python/paddle/fluid/tests/unittests/test_atan2_op.py @@ -34,6 +34,7 @@ class TestAtan2(OpTest): def setUp(self): self.op_type = "atan2" self.python_api = paddle.atan2 + self.enable_cinn = True self.init_dtype() x1 = np.random.uniform(-1, -0.1, [15, 17]).astype(self.dtype) @@ -44,10 +45,10 @@ def setUp(self): self.outputs = {'Out': out} def test_check_grad(self): - self.check_grad(['X1', 'X2'], 'Out') + self.check_grad(['X1', 'X2'], 'Out', check_cinn=self.enable_cinn) def test_check_output(self): - self.check_output() + self.check_output(check_cinn=self.enable_cinn) def init_dtype(self): self.dtype = np.float64 @@ -67,6 +68,7 @@ def test_check_grad(self): self.inputs['X2'], 1 / self.inputs['X1'].size, ), + check_cinn=self.enable_cinn, ) @@ -139,6 +141,7 @@ def setUp(self): self.op_type = 'atan2' self.python_api = paddle.atan2 self.dtype = np.uint16 + self.enable_cinn = True x1 = np.random.uniform(-1, -0.1, [15, 17]).astype('float32') x2 = np.random.uniform(0.1, 1, [15, 17]).astype('float32') out = np.arctan2(x1, x2) @@ -151,11 +154,13 @@ def setUp(self): def test_check_output(self): place = core.CUDAPlace(0) - self.check_output_with_place(place) + self.check_output_with_place(place, check_cinn=self.enable_cinn) def test_check_grad(self): place = core.CUDAPlace(0) - self.check_grad_with_place(place, ['X1', 'X2'], 'Out') + self.check_grad_with_place( + place, ['X1', 'X2'], 'Out', check_cinn=self.enable_cinn + ) class TestAtan2Error(unittest.TestCase): diff --git a/python/paddle/fluid/tests/unittests/test_tile_op.py b/python/paddle/fluid/tests/unittests/test_tile_op.py index feca03c5a0cad..e5b192c68023d 100644 --- a/python/paddle/fluid/tests/unittests/test_tile_op.py +++ b/python/paddle/fluid/tests/unittests/test_tile_op.py @@ -44,7 +44,7 @@ def init_data(self): self.repeat_times = [2] def test_check_output(self): - self.check_output() + self.check_output(check_cinn=self.enable_cinn) def test_check_grad(self): self.check_grad(['X'], 'Out', check_prim=True) @@ -109,6 +109,7 @@ def init_data(self): # Situation 2: repeat_times is a list (with tensor) +# CINN not support repeat_times is a tensor now class TestTileOpRank1_tensor_attr(OpTest): def setUp(self): self.op_type = "tile" @@ -155,6 +156,7 @@ def init_data(self): # Situation 3: repeat_times is a tensor +# CINN not support repeat_times is a tensor now class TestTileOpRank1_tensor(OpTest): def setUp(self): self.op_type = "tile" @@ -191,6 +193,7 @@ class TestTileOpInteger(OpTest): def setUp(self): self.op_type = "tile" self.python_api = paddle.tile + self.enable_cinn = True self.inputs = { 'X': np.random.randint(10, size=(4, 4, 5)).astype("int32") } @@ -199,7 +202,7 @@ def setUp(self): self.outputs = {'Out': output} def test_check_output(self): - self.check_output() + self.check_output(check_cinn=self.enable_cinn) class TestTileFP16OP(OpTest): @@ -223,7 +226,7 @@ def init_data(self): self.repeat_times = [2, 1, 4] def test_check_output(self): - self.check_output() + self.check_output(check_cinn=self.enable_cinn) def test_check_grad(self): self.check_grad(['X'], 'Out', check_prim=True) @@ -251,7 +254,7 @@ def setUp(self): def test_check_output(self): place = core.CUDAPlace(0) - self.check_output_with_place(place) + self.check_output_with_place(place, check_cinn=self.enable_cinn) def init_data(self): self.dtype = np.uint16 @@ -268,13 +271,14 @@ class TestTileOpBoolean(OpTest): def setUp(self): self.op_type = "tile" self.python_api = paddle.tile + self.enable_cinn = True self.inputs = {'X': np.random.randint(2, size=(2, 4, 5)).astype("bool")} self.attrs = {'repeat_times': [2, 1, 4]} output = np.tile(self.inputs['X'], (2, 1, 4)) self.outputs = {'Out': output} def test_check_output(self): - self.check_output() + self.check_output(check_cinn=self.enable_cinn) # Situation 56: input x is Integer @@ -282,6 +286,7 @@ class TestTileOpInt64_t(OpTest): def setUp(self): self.op_type = "tile" self.python_api = paddle.tile + self.enable_cinn = True self.inputs = { 'X': np.random.randint(10, size=(2, 4, 5)).astype("int64") } @@ -290,7 +295,7 @@ def setUp(self): self.outputs = {'Out': output} def test_check_output(self): - self.check_output() + self.check_output(check_cinn=self.enable_cinn) class TestTileError(unittest.TestCase): diff --git a/python/paddle/fluid/tests/unittests/test_top_k_op.py b/python/paddle/fluid/tests/unittests/test_top_k_op.py index 69b5fd3da908c..814a014baff5d 100644 --- a/python/paddle/fluid/tests/unittests/test_top_k_op.py +++ b/python/paddle/fluid/tests/unittests/test_top_k_op.py @@ -26,6 +26,7 @@ def setUp(self): self.set_args() self.op_type = "top_k" self.dtype = np.float64 + self.enable_cinn = True self.init_dtype() k = self.top_k @@ -54,10 +55,10 @@ def set_args(self): self.top_k = 1 def test_check_output(self): - self.check_output() + self.check_output(check_cinn=self.enable_cinn) def test_check_grad(self): - self.check_grad({'X'}, 'Out') + self.check_grad({'X'}, 'Out', check_cinn=self.enable_cinn) if __name__ == "__main__": diff --git a/python/paddle/fluid/tests/unittests/test_where_op.py b/python/paddle/fluid/tests/unittests/test_where_op.py index f9c093b3cb517..abef66ce10b1e 100644 --- a/python/paddle/fluid/tests/unittests/test_where_op.py +++ b/python/paddle/fluid/tests/unittests/test_where_op.py @@ -27,15 +27,16 @@ class TestWhereOp(OpTest): def setUp(self): self.op_type = 'where' self.python_api = paddle.where + self.enable_cinn = True self.init_config() self.inputs = {'Condition': self.cond, 'X': self.x, 'Y': self.y} self.outputs = {'Out': np.where(self.cond, self.x, self.y)} def test_check_output(self): - self.check_output() + self.check_output(check_cinn=self.enable_cinn) def test_check_grad(self): - self.check_grad(['X', 'Y'], 'Out') + self.check_grad(['X', 'Y'], 'Out', check_cinn=self.enable_cinn) def init_config(self): self.x = np.random.uniform((-3), 5, 100).astype('float64') @@ -68,6 +69,7 @@ def setUp(self): self.op_type = 'where' self.dtype = np.uint16 self.python_api = paddle.where + self.enable_cinn = True self.init_config() self.inputs = { 'Condition': self.cond, @@ -80,12 +82,12 @@ def setUp(self): def test_check_output(self): place = core.CUDAPlace(0) - self.check_output_with_place(place) + self.check_output_with_place(place, check_cinn=self.enable_cinn) def test_check_grad(self): place = core.CUDAPlace(0) self.check_grad_with_place( - place, ['X', 'Y'], 'Out', numeric_grad_delta=0.05 + place, ['X', 'Y'], 'Out', numeric_grad_delta=0.05, check_cinn=self.enable_cinn ) def init_config(self): From 8a7b65c31837a6feb7737c716e44dfe20a441a1d Mon Sep 17 00:00:00 2001 From: Fisher Date: Thu, 1 Jun 2023 11:20:56 +0000 Subject: [PATCH 02/12] Update cmakelists in legacy_test --- test/legacy_test/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/legacy_test/CMakeLists.txt b/test/legacy_test/CMakeLists.txt index ddbf15294f75e..94ebc709f1c32 100644 --- a/test/legacy_test/CMakeLists.txt +++ b/test/legacy_test/CMakeLists.txt @@ -1187,7 +1187,10 @@ set(TEST_CINN_OPS test_tile_op test_roll_op test_sum_op - test_elementwise_min_op) + test_elementwise_min_op + test_atan2_op + test_top_k_op + test_where_op) foreach(TEST_CINN_OPS ${TEST_CINN_OPS}) if(WITH_CINN) From 02f52f84074d57b07ae03f361d85238801b49475 Mon Sep 17 00:00:00 2001 From: Fisher Date: Thu, 1 Jun 2023 12:36:30 +0000 Subject: [PATCH 03/12] Reformat code --- test/legacy_test/test_where_op.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/legacy_test/test_where_op.py b/test/legacy_test/test_where_op.py index abef66ce10b1e..d4608a5925afa 100644 --- a/test/legacy_test/test_where_op.py +++ b/test/legacy_test/test_where_op.py @@ -87,7 +87,11 @@ def test_check_output(self): def test_check_grad(self): place = core.CUDAPlace(0) self.check_grad_with_place( - place, ['X', 'Y'], 'Out', numeric_grad_delta=0.05, check_cinn=self.enable_cinn + place, + ['X', 'Y'], + 'Out', + numeric_grad_delta=0.05, + check_cinn=self.enable_cinn, ) def init_config(self): From 9bea2398ecf7935fd53da6843e04964fb9b14c63 Mon Sep 17 00:00:00 2001 From: Fisher Date: Fri, 2 Jun 2023 06:10:59 +0000 Subject: [PATCH 04/12] Enable check_cinn on op take_along_axis legacy test --- test/legacy_test/CMakeLists.txt | 3 ++- test/legacy_test/test_take_along_axis_op.py | 12 ++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/test/legacy_test/CMakeLists.txt b/test/legacy_test/CMakeLists.txt index 94ebc709f1c32..0b4d7f67212b7 100644 --- a/test/legacy_test/CMakeLists.txt +++ b/test/legacy_test/CMakeLists.txt @@ -1190,7 +1190,8 @@ set(TEST_CINN_OPS test_elementwise_min_op test_atan2_op test_top_k_op - test_where_op) + test_where_op + test_take_along_axis_op) foreach(TEST_CINN_OPS ${TEST_CINN_OPS}) if(WITH_CINN) diff --git a/test/legacy_test/test_take_along_axis_op.py b/test/legacy_test/test_take_along_axis_op.py index 4180a7c4dc758..136cfce330028 100644 --- a/test/legacy_test/test_take_along_axis_op.py +++ b/test/legacy_test/test_take_along_axis_op.py @@ -28,6 +28,7 @@ def setUp(self): self.init_data() self.op_type = "take_along_axis" self.python_api = paddle.tensor.take_along_axis + self.enable_cinn = True self.xnp = np.random.random(self.x_shape).astype(self.x_type) self.target = np.take_along_axis(self.xnp, self.index, self.axis) broadcast_shape_list = list(self.x_shape) @@ -42,10 +43,10 @@ def setUp(self): self.outputs = {'Result': self.target} def test_check_output(self): - self.check_output() + self.check_output(check_cinn=self.enable_cinn) def test_check_grad(self): - self.check_grad(['Input'], 'Result') + self.check_grad(['Input'], 'Result', check_cinn=self.enable_cinn) def init_data(self): self.x_type = "float64" @@ -81,6 +82,7 @@ def setUp(self): self.init_data() self.op_type = "take_along_axis" self.python_api = paddle.tensor.take_along_axis + self.enable_cinn = True self.xnp = np.random.random(self.x_shape).astype(self.x_type) self.target = np.take_along_axis(self.xnp, self.index, self.axis) broadcast_shape_list = list(self.x_shape) @@ -99,10 +101,12 @@ def setUp(self): self.place = core.CUDAPlace(0) def test_check_output(self): - self.check_output_with_place(self.place) + self.check_output_with_place(self.place, check_cinn=self.enable_cinn) def test_check_grad(self): - self.check_grad_with_place(self.place, ['Input'], 'Result') + self.check_grad_with_place( + self.place, ['Input'], 'Result', check_cinn=self.enable_cinn + ) def init_data(self): self.dtype = np.uint16 From 42323e676e21c9904f91c6af37f912ec5abc4e18 Mon Sep 17 00:00:00 2001 From: Fisher Date: Tue, 6 Jun 2023 09:33:53 +0000 Subject: [PATCH 05/12] Enable check_cinn on pool2d --- test/legacy_test/CMakeLists.txt | 5 +++-- test/legacy_test/test_pool2d_op.py | 23 +++++++++++++++++++---- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/test/legacy_test/CMakeLists.txt b/test/legacy_test/CMakeLists.txt index eaa5593dd035a..66e72aeeaeb54 100644 --- a/test/legacy_test/CMakeLists.txt +++ b/test/legacy_test/CMakeLists.txt @@ -1035,7 +1035,7 @@ set_tests_properties(test_program_prune_backward PROPERTIES TIMEOUT 120) set_tests_properties(test_group_norm_op PROPERTIES TIMEOUT 120) set_tests_properties(test_imperative_optimizer PROPERTIES TIMEOUT 250) set_tests_properties(test_imperative_optimizer_v2 PROPERTIES TIMEOUT 250) -set_tests_properties(test_pool2d_op PROPERTIES TIMEOUT 120) +set_tests_properties(test_pool2d_op PROPERTIES TIMEOUT 200) set_tests_properties(test_transpose_op PROPERTIES TIMEOUT 120) set_tests_properties(test_activation_op PROPERTIES TIMEOUT 270) set_tests_properties(test_normal PROPERTIES TIMEOUT 120) @@ -1199,7 +1199,8 @@ set(TEST_CINN_OPS test_flip test_triangular_solve_op test_scatter_nd_op - test_strided_slice_op) + test_strided_slice_op + test_pool2d_op) foreach(TEST_CINN_OPS ${TEST_CINN_OPS}) if(WITH_CINN) diff --git a/test/legacy_test/test_pool2d_op.py b/test/legacy_test/test_pool2d_op.py index e929d2776bfa8..41503684c9fc6 100644 --- a/test/legacy_test/test_pool2d_op.py +++ b/test/legacy_test/test_pool2d_op.py @@ -422,10 +422,15 @@ def test_check_output(self): if self.has_cudnn(): place = core.CUDAPlace(0) self.check_output_with_place( - place, atol=1e-5, check_dygraph=(not self.use_mkldnn) + place, + atol=1e-5, + check_dygraph=(not self.use_mkldnn), + check_cinn=True, ) else: - self.check_output(check_dygraph=(not self.use_mkldnn)) + self.check_output( + check_dygraph=(not self.use_mkldnn), check_cinn=False + ) def test_check_grad(self): if self.dtype == np.float16: @@ -438,6 +443,7 @@ def test_check_grad(self): {'X'}, 'Out', check_dygraph=(not self.use_mkldnn), + check_cinn=True, ) elif self.pool_type != "max": self.check_grad( @@ -445,6 +451,7 @@ def test_check_grad(self): 'Out', max_relative_error=0.07, check_dygraph=(not self.use_mkldnn), + check_cinn=False, ) def init_data_format(self): @@ -587,6 +594,7 @@ def test_check_output(self): self.check_output_with_place( place, check_dygraph=(not self.use_mkldnn), + check_cinn=True, ) def test_check_grad(self): @@ -602,6 +610,7 @@ def test_check_grad(self): {'X'}, 'Out', check_dygraph=(not self.use_mkldnn), + check_cinn=True, ) cls_name = "{}_{}".format(parent.__name__, "CUDNNFp16Op") @@ -626,6 +635,7 @@ def test_check_output(self): self.check_output_with_place( place, check_dygraph=(not self.use_mkldnn), + check_cinn=True, ) def test_check_grad(self): @@ -641,6 +651,7 @@ def test_check_grad(self): {'X'}, 'Out', check_dygraph=(not self.use_mkldnn), + check_cinn=True, ) cls_name = "{}_{}".format(parent.__name__, "Fp16Op") @@ -663,6 +674,7 @@ def test_check_output(self): self.check_output_with_place( place, check_dygraph=(not self.use_mkldnn), + check_cinn=True, ) def test_check_grad(self): @@ -673,6 +685,7 @@ def test_check_grad(self): {'X'}, 'Out', check_dygraph=(not self.use_mkldnn), + check_cinn=True, ) cls_name = "{}_{}".format(parent.__name__, "Bf16Op") @@ -1002,10 +1015,12 @@ def test_check_grad(self): if self.has_cudnn() and self.pool_type == "max": place = core.CUDAPlace(0) self.check_grad_with_place( - place, {'X'}, 'Out', max_relative_error=1.00 + place, {'X'}, 'Out', max_relative_error=1.00, check_cinn=True ) elif self.pool_type == "max": - self.check_grad({'X'}, 'Out', max_relative_error=1.00) + self.check_grad( + {'X'}, 'Out', max_relative_error=1.00, check_cinn=True + ) class TestCase5_channel_last_Max(TestCase5_Max): From 1d5989546d07f797b4b338ab94a83ea02986ab12 Mon Sep 17 00:00:00 2001 From: Fisher Date: Tue, 6 Jun 2023 09:47:01 +0000 Subject: [PATCH 06/12] Remove check_cinn=False --- test/legacy_test/test_pool2d_op.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/test/legacy_test/test_pool2d_op.py b/test/legacy_test/test_pool2d_op.py index 41503684c9fc6..e20df56ab0f98 100644 --- a/test/legacy_test/test_pool2d_op.py +++ b/test/legacy_test/test_pool2d_op.py @@ -428,9 +428,7 @@ def test_check_output(self): check_cinn=True, ) else: - self.check_output( - check_dygraph=(not self.use_mkldnn), check_cinn=False - ) + self.check_output(check_dygraph=(not self.use_mkldnn)) def test_check_grad(self): if self.dtype == np.float16: @@ -451,7 +449,6 @@ def test_check_grad(self): 'Out', max_relative_error=0.07, check_dygraph=(not self.use_mkldnn), - check_cinn=False, ) def init_data_format(self): From 1bc8a41a2bec7a2c8ca85f18ad4bd8052605bda0 Mon Sep 17 00:00:00 2001 From: Fisher Date: Thu, 8 Jun 2023 09:56:19 +0000 Subject: [PATCH 07/12] Try fix tile test error --- test/legacy_test/test_tile_op.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/legacy_test/test_tile_op.py b/test/legacy_test/test_tile_op.py index e5b192c68023d..602c74ab1a328 100644 --- a/test/legacy_test/test_tile_op.py +++ b/test/legacy_test/test_tile_op.py @@ -74,36 +74,42 @@ def init_data(self): # with dimension expanding class TestTileOpRank2Expanding(TestTileOpRank1): def init_data(self): + self.enable_cinn = True self.ori_shape = [120] self.repeat_times = [2, 2] class TestTileOpRank2(TestTileOpRank1): def init_data(self): + self.enable_cinn = True self.ori_shape = [12, 14] self.repeat_times = [2, 3] class TestTileOpRank3_Corner(TestTileOpRank1): def init_data(self): + self.enable_cinn = True self.ori_shape = (2, 10, 5) self.repeat_times = (1, 1, 1) class TestTileOpRank3_Corner2(TestTileOpRank1): def init_data(self): + self.enable_cinn = True self.ori_shape = (2, 10, 5) self.repeat_times = (2, 2) class TestTileOpRank3(TestTileOpRank1): def init_data(self): + self.enable_cinn = True self.ori_shape = (2, 4, 15) self.repeat_times = (2, 1, 4) class TestTileOpRank4(TestTileOpRank1): def init_data(self): + self.enable_cinn = True self.ori_shape = (2, 4, 5, 7) self.repeat_times = (3, 2, 1, 2) From a3905a30690a028ea1c22bb4a4909a43159a5314 Mon Sep 17 00:00:00 2001 From: Fisher Date: Thu, 8 Jun 2023 11:08:45 +0000 Subject: [PATCH 08/12] Rename enable_cinn to test_cinn --- test/legacy_test/test_tile_op.py | 42 ++++++++++++++++---------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/test/legacy_test/test_tile_op.py b/test/legacy_test/test_tile_op.py index 602c74ab1a328..cfdf3e313e6fa 100644 --- a/test/legacy_test/test_tile_op.py +++ b/test/legacy_test/test_tile_op.py @@ -30,7 +30,7 @@ def setUp(self): self.op_type = "tile" self.python_api = paddle.tile self.prim_op_type = "prim" - self.enable_cinn = True + self.test_cinn = True self.public_python_api = paddle.tile self.init_data() @@ -44,7 +44,7 @@ def init_data(self): self.repeat_times = [2] def test_check_output(self): - self.check_output(check_cinn=self.enable_cinn) + self.check_output(check_cinn=self.test_cinn) def test_check_grad(self): self.check_grad(['X'], 'Out', check_prim=True) @@ -52,21 +52,21 @@ def test_check_grad(self): class TestTileOpRank_ZeroDim1(TestTileOpRank1): def init_data(self): - self.enable_cinn = False + self.test_cinn = False self.ori_shape = [] self.repeat_times = [] class TestTileOpRank_ZeroDim2(TestTileOpRank1): def init_data(self): - self.enable_cinn = False + self.test_cinn = False self.ori_shape = [] self.repeat_times = [2] class TestTileOpRank_ZeroDim3(TestTileOpRank1): def init_data(self): - self.enable_cinn = False + self.test_cinn = False self.ori_shape = [] self.repeat_times = [2, 3] @@ -74,42 +74,42 @@ def init_data(self): # with dimension expanding class TestTileOpRank2Expanding(TestTileOpRank1): def init_data(self): - self.enable_cinn = True + self.test_cinn = True self.ori_shape = [120] self.repeat_times = [2, 2] class TestTileOpRank2(TestTileOpRank1): def init_data(self): - self.enable_cinn = True + self.test_cinn = True self.ori_shape = [12, 14] self.repeat_times = [2, 3] class TestTileOpRank3_Corner(TestTileOpRank1): def init_data(self): - self.enable_cinn = True + self.test_cinn = True self.ori_shape = (2, 10, 5) self.repeat_times = (1, 1, 1) class TestTileOpRank3_Corner2(TestTileOpRank1): def init_data(self): - self.enable_cinn = True + self.test_cinn = True self.ori_shape = (2, 10, 5) self.repeat_times = (2, 2) class TestTileOpRank3(TestTileOpRank1): def init_data(self): - self.enable_cinn = True + self.test_cinn = True self.ori_shape = (2, 4, 15) self.repeat_times = (2, 1, 4) class TestTileOpRank4(TestTileOpRank1): def init_data(self): - self.enable_cinn = True + self.test_cinn = True self.ori_shape = (2, 4, 5, 7) self.repeat_times = (3, 2, 1, 2) @@ -199,7 +199,7 @@ class TestTileOpInteger(OpTest): def setUp(self): self.op_type = "tile" self.python_api = paddle.tile - self.enable_cinn = True + self.test_cinn = True self.inputs = { 'X': np.random.randint(10, size=(4, 4, 5)).astype("int32") } @@ -208,7 +208,7 @@ def setUp(self): self.outputs = {'Out': output} def test_check_output(self): - self.check_output(check_cinn=self.enable_cinn) + self.check_output(check_cinn=self.test_cinn) class TestTileFP16OP(OpTest): @@ -217,7 +217,7 @@ def setUp(self): self.dtype = np.float16 self.python_api = paddle.tile self.prim_op_type = "prim" - self.enable_cinn = True + self.test_cinn = True self.public_python_api = paddle.tile self.init_data() x = np.random.uniform(10, size=self.ori_shape).astype(self.dtype) @@ -232,7 +232,7 @@ def init_data(self): self.repeat_times = [2, 1, 4] def test_check_output(self): - self.check_output(check_cinn=self.enable_cinn) + self.check_output(check_cinn=self.test_cinn) def test_check_grad(self): self.check_grad(['X'], 'Out', check_prim=True) @@ -249,7 +249,7 @@ def setUp(self): self.__class__.op_type = self.op_type self.python_api = paddle.tile self.prim_op_type = "prim" - self.enable_cinn = False + self.test_cinn = False self.public_python_api = paddle.tile self.init_data() x = np.random.uniform(10, size=self.ori_shape).astype(np.float32) @@ -260,7 +260,7 @@ def setUp(self): def test_check_output(self): place = core.CUDAPlace(0) - self.check_output_with_place(place, check_cinn=self.enable_cinn) + self.check_output_with_place(place, check_cinn=self.test_cinn) def init_data(self): self.dtype = np.uint16 @@ -277,14 +277,14 @@ class TestTileOpBoolean(OpTest): def setUp(self): self.op_type = "tile" self.python_api = paddle.tile - self.enable_cinn = True + self.test_cinn = True self.inputs = {'X': np.random.randint(2, size=(2, 4, 5)).astype("bool")} self.attrs = {'repeat_times': [2, 1, 4]} output = np.tile(self.inputs['X'], (2, 1, 4)) self.outputs = {'Out': output} def test_check_output(self): - self.check_output(check_cinn=self.enable_cinn) + self.check_output(check_cinn=self.test_cinn) # Situation 56: input x is Integer @@ -292,7 +292,7 @@ class TestTileOpInt64_t(OpTest): def setUp(self): self.op_type = "tile" self.python_api = paddle.tile - self.enable_cinn = True + self.test_cinn = True self.inputs = { 'X': np.random.randint(10, size=(2, 4, 5)).astype("int64") } @@ -301,7 +301,7 @@ def setUp(self): self.outputs = {'Out': output} def test_check_output(self): - self.check_output(check_cinn=self.enable_cinn) + self.check_output(check_cinn=self.test_cinn) class TestTileError(unittest.TestCase): From 002b551c1c6ae3daba9577196e4dea84a8ed5e1e Mon Sep 17 00:00:00 2001 From: Fisher Date: Thu, 8 Jun 2023 12:34:30 +0000 Subject: [PATCH 09/12] Refactor test_tile_op --- test/legacy_test/test_tile_op.py | 62 +++++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 17 deletions(-) diff --git a/test/legacy_test/test_tile_op.py b/test/legacy_test/test_tile_op.py index e152af7bd01a9..36154df44a6f4 100644 --- a/test/legacy_test/test_tile_op.py +++ b/test/legacy_test/test_tile_op.py @@ -40,14 +40,14 @@ def setUp(self): self.outputs = {'Out': output} def if_enable_cinn(self): - pass + self.enable_cinn = True def init_data(self): self.ori_shape = [100] self.repeat_times = [2] def test_check_output(self): - self.check_output(check_cinn=self.test_cinn) + self.check_output(check_cinn=self.enable_cinn) def test_check_grad(self): self.check_grad(['X'], 'Out', check_prim=True) @@ -83,45 +83,57 @@ def if_enable_cinn(self): # with dimension expanding class TestTileOpRank2Expanding(TestTileOpRank1): def init_data(self): - self.test_cinn = True self.ori_shape = [120] self.repeat_times = [2, 2] + def if_enable_cinn(self): + self.enable_cinn = True + class TestTileOpRank2(TestTileOpRank1): def init_data(self): - self.test_cinn = True self.ori_shape = [12, 14] self.repeat_times = [2, 3] + def if_enable_cinn(self): + self.enable_cinn = True + class TestTileOpRank3_Corner(TestTileOpRank1): def init_data(self): - self.test_cinn = True self.ori_shape = (2, 10, 5) self.repeat_times = (1, 1, 1) + def if_enable_cinn(self): + self.enable_cinn = True + class TestTileOpRank3_Corner2(TestTileOpRank1): def init_data(self): - self.test_cinn = True self.ori_shape = (2, 10, 5) self.repeat_times = (2, 2) + def if_enable_cinn(self): + self.enable_cinn = True + class TestTileOpRank3(TestTileOpRank1): def init_data(self): - self.test_cinn = True self.ori_shape = (2, 4, 15) self.repeat_times = (2, 1, 4) + def if_enable_cinn(self): + self.enable_cinn = True + class TestTileOpRank4(TestTileOpRank1): def init_data(self): - self.test_cinn = True self.ori_shape = (2, 4, 5, 7) self.repeat_times = (3, 2, 1, 2) + def if_enable_cinn(self): + self.enable_cinn = True + # Situation 2: repeat_times is a list (with tensor) # CINN not support repeat_times is a tensor now @@ -208,16 +220,19 @@ class TestTileOpInteger(OpTest): def setUp(self): self.op_type = "tile" self.python_api = paddle.tile - self.test_cinn = True self.inputs = { 'X': np.random.randint(10, size=(4, 4, 5)).astype("int32") } self.attrs = {'repeat_times': [2, 1, 4]} output = np.tile(self.inputs['X'], (2, 1, 4)) self.outputs = {'Out': output} + self.if_enable_cinn() + + def if_enable_cinn(self): + self.enable_cinn = True def test_check_output(self): - self.check_output(check_cinn=self.test_cinn) + self.check_output(check_cinn=self.enable_cinn) class TestTileFP16OP(OpTest): @@ -226,7 +241,6 @@ def setUp(self): self.dtype = np.float16 self.python_api = paddle.tile self.prim_op_type = "prim" - self.test_cinn = True self.public_python_api = paddle.tile self.init_data() x = np.random.uniform(10, size=self.ori_shape).astype(self.dtype) @@ -234,6 +248,10 @@ def setUp(self): self.inputs = {'X': x} self.attrs = {'repeat_times': self.repeat_times} self.outputs = {'Out': output} + self.if_enable_cinn() + + def if_enable_cinn(self): + self.enable_cinn = True def init_data(self): self.dtype = np.float16 @@ -241,7 +259,7 @@ def init_data(self): self.repeat_times = [2, 1, 4] def test_check_output(self): - self.check_output(check_cinn=self.test_cinn) + self.check_output(check_cinn=self.enable_cinn) def test_check_grad(self): self.check_grad(['X'], 'Out', check_prim=True) @@ -265,10 +283,14 @@ def setUp(self): self.inputs = {'X': convert_float_to_uint16(x)} self.attrs = {'repeat_times': self.repeat_times} self.outputs = {'Out': convert_float_to_uint16(output)} + self.if_enable_cinn() + + def if_enable_cinn(self): + self.enable_cinn = True def test_check_output(self): place = core.CUDAPlace(0) - self.check_output_with_place(place, check_cinn=self.test_cinn) + self.check_output_with_place(place, check_cinn=self.enable_cinn) def init_data(self): self.dtype = np.uint16 @@ -285,14 +307,17 @@ class TestTileOpBoolean(OpTest): def setUp(self): self.op_type = "tile" self.python_api = paddle.tile - self.test_cinn = True self.inputs = {'X': np.random.randint(2, size=(2, 4, 5)).astype("bool")} self.attrs = {'repeat_times': [2, 1, 4]} output = np.tile(self.inputs['X'], (2, 1, 4)) self.outputs = {'Out': output} + self.if_enable_cinn() + + def if_enable_cinn(self): + self.enable_cinn = True def test_check_output(self): - self.check_output(check_cinn=self.test_cinn) + self.check_output(check_cinn=self.enable_cinn) # Situation 56: input x is Integer @@ -300,16 +325,19 @@ class TestTileOpInt64_t(OpTest): def setUp(self): self.op_type = "tile" self.python_api = paddle.tile - self.test_cinn = True self.inputs = { 'X': np.random.randint(10, size=(2, 4, 5)).astype("int64") } self.attrs = {'repeat_times': [2, 1, 4]} output = np.tile(self.inputs['X'], (2, 1, 4)) self.outputs = {'Out': output} + self.if_enable_cinn() + + def if_enable_cinn(self): + self.enable_cinn = True def test_check_output(self): - self.check_output(check_cinn=self.test_cinn) + self.check_output(check_cinn=self.enable_cinn) class TestTileError(unittest.TestCase): From 4bd4d10c8067af069790f14fda48c139cae84007 Mon Sep 17 00:00:00 2001 From: Fisher Date: Fri, 9 Jun 2023 07:12:07 +0000 Subject: [PATCH 10/12] Replace all enable_cinn to check_cinn --- test/legacy_test/test_atan2_op.py | 14 ++--- test/legacy_test/test_take_along_axis_op.py | 12 ++--- test/legacy_test/test_tile_op.py | 57 +++++++++++++-------- test/legacy_test/test_top_k_op.py | 6 +-- test/legacy_test/test_where_op.py | 12 ++--- 5 files changed, 57 insertions(+), 44 deletions(-) diff --git a/test/legacy_test/test_atan2_op.py b/test/legacy_test/test_atan2_op.py index 37c577ef12ca4..ddcaa40dee980 100644 --- a/test/legacy_test/test_atan2_op.py +++ b/test/legacy_test/test_atan2_op.py @@ -34,7 +34,7 @@ class TestAtan2(OpTest): def setUp(self): self.op_type = "atan2" self.python_api = paddle.atan2 - self.enable_cinn = True + self.check_cinn = True self.init_dtype() x1 = np.random.uniform(-1, -0.1, [15, 17]).astype(self.dtype) @@ -45,10 +45,10 @@ def setUp(self): self.outputs = {'Out': out} def test_check_grad(self): - self.check_grad(['X1', 'X2'], 'Out', check_cinn=self.enable_cinn) + self.check_grad(['X1', 'X2'], 'Out', check_cinn=self.check_cinn) def test_check_output(self): - self.check_output(check_cinn=self.enable_cinn) + self.check_output(check_cinn=self.check_cinn) def init_dtype(self): self.dtype = np.float64 @@ -68,7 +68,7 @@ def test_check_grad(self): self.inputs['X2'], 1 / self.inputs['X1'].size, ), - check_cinn=self.enable_cinn, + check_cinn=self.check_cinn, ) @@ -141,7 +141,7 @@ def setUp(self): self.op_type = 'atan2' self.python_api = paddle.atan2 self.dtype = np.uint16 - self.enable_cinn = True + self.check_cinn = True x1 = np.random.uniform(-1, -0.1, [15, 17]).astype('float32') x2 = np.random.uniform(0.1, 1, [15, 17]).astype('float32') out = np.arctan2(x1, x2) @@ -154,12 +154,12 @@ def setUp(self): def test_check_output(self): place = core.CUDAPlace(0) - self.check_output_with_place(place, check_cinn=self.enable_cinn) + self.check_output_with_place(place, check_cinn=self.check_cinn) def test_check_grad(self): place = core.CUDAPlace(0) self.check_grad_with_place( - place, ['X1', 'X2'], 'Out', check_cinn=self.enable_cinn + place, ['X1', 'X2'], 'Out', check_cinn=self.check_cinn ) diff --git a/test/legacy_test/test_take_along_axis_op.py b/test/legacy_test/test_take_along_axis_op.py index 136cfce330028..6805b9b623406 100644 --- a/test/legacy_test/test_take_along_axis_op.py +++ b/test/legacy_test/test_take_along_axis_op.py @@ -28,7 +28,7 @@ def setUp(self): self.init_data() self.op_type = "take_along_axis" self.python_api = paddle.tensor.take_along_axis - self.enable_cinn = True + self.check_cinn = True self.xnp = np.random.random(self.x_shape).astype(self.x_type) self.target = np.take_along_axis(self.xnp, self.index, self.axis) broadcast_shape_list = list(self.x_shape) @@ -43,10 +43,10 @@ def setUp(self): self.outputs = {'Result': self.target} def test_check_output(self): - self.check_output(check_cinn=self.enable_cinn) + self.check_output(check_cinn=self.check_cinn) def test_check_grad(self): - self.check_grad(['Input'], 'Result', check_cinn=self.enable_cinn) + self.check_grad(['Input'], 'Result', check_cinn=self.check_cinn) def init_data(self): self.x_type = "float64" @@ -82,7 +82,7 @@ def setUp(self): self.init_data() self.op_type = "take_along_axis" self.python_api = paddle.tensor.take_along_axis - self.enable_cinn = True + self.check_cinn = True self.xnp = np.random.random(self.x_shape).astype(self.x_type) self.target = np.take_along_axis(self.xnp, self.index, self.axis) broadcast_shape_list = list(self.x_shape) @@ -101,11 +101,11 @@ def setUp(self): self.place = core.CUDAPlace(0) def test_check_output(self): - self.check_output_with_place(self.place, check_cinn=self.enable_cinn) + self.check_output_with_place(self.place, check_cinn=self.check_cinn) def test_check_grad(self): self.check_grad_with_place( - self.place, ['Input'], 'Result', check_cinn=self.enable_cinn + self.place, ['Input'], 'Result', check_cinn=self.check_cinn ) def init_data(self): diff --git a/test/legacy_test/test_tile_op.py b/test/legacy_test/test_tile_op.py index 36154df44a6f4..ed463afaf014d 100644 --- a/test/legacy_test/test_tile_op.py +++ b/test/legacy_test/test_tile_op.py @@ -33,6 +33,7 @@ def setUp(self): self.public_python_api = paddle.tile self.init_data() self.if_enable_cinn() + self.if_check_prim() self.inputs = {'X': np.random.random(self.ori_shape).astype("float64")} self.attrs = {'repeat_times': self.repeat_times} @@ -40,17 +41,20 @@ def setUp(self): self.outputs = {'Out': output} def if_enable_cinn(self): - self.enable_cinn = True + self.check_cinn = True + + def if_check_prim(self): + self.check_prim = True def init_data(self): self.ori_shape = [100] self.repeat_times = [2] def test_check_output(self): - self.check_output(check_cinn=self.enable_cinn) + self.check_output(check_cinn=self.check_cinn) def test_check_grad(self): - self.check_grad(['X'], 'Out', check_prim=True) + self.check_grad(['X'], 'Out', check_prim=self.check_prim) class TestTileOpRank_ZeroDim1(TestTileOpRank1): @@ -59,7 +63,10 @@ def init_data(self): self.repeat_times = [] def if_enable_cinn(self): - self.enable_cinn = False + self.check_cinn = False + + def if_check_prim(self): + self.check_prim = False class TestTileOpRank_ZeroDim2(TestTileOpRank1): @@ -68,7 +75,10 @@ def init_data(self): self.repeat_times = [2] def if_enable_cinn(self): - self.enable_cinn = False + self.check_cinn = False + + def if_check_prim(self): + self.check_prim = False class TestTileOpRank_ZeroDim3(TestTileOpRank1): @@ -77,7 +87,10 @@ def init_data(self): self.repeat_times = [2, 3] def if_enable_cinn(self): - self.enable_cinn = False + self.check_cinn = False + + def if_check_prim(self): + self.check_prim = False # with dimension expanding @@ -87,7 +100,7 @@ def init_data(self): self.repeat_times = [2, 2] def if_enable_cinn(self): - self.enable_cinn = True + self.check_cinn = True class TestTileOpRank2(TestTileOpRank1): @@ -96,7 +109,7 @@ def init_data(self): self.repeat_times = [2, 3] def if_enable_cinn(self): - self.enable_cinn = True + self.check_cinn = True class TestTileOpRank3_Corner(TestTileOpRank1): @@ -105,7 +118,7 @@ def init_data(self): self.repeat_times = (1, 1, 1) def if_enable_cinn(self): - self.enable_cinn = True + self.check_cinn = True class TestTileOpRank3_Corner2(TestTileOpRank1): @@ -114,7 +127,7 @@ def init_data(self): self.repeat_times = (2, 2) def if_enable_cinn(self): - self.enable_cinn = True + self.check_cinn = True class TestTileOpRank3(TestTileOpRank1): @@ -123,7 +136,7 @@ def init_data(self): self.repeat_times = (2, 1, 4) def if_enable_cinn(self): - self.enable_cinn = True + self.check_cinn = True class TestTileOpRank4(TestTileOpRank1): @@ -132,7 +145,7 @@ def init_data(self): self.repeat_times = (3, 2, 1, 2) def if_enable_cinn(self): - self.enable_cinn = True + self.check_cinn = True # Situation 2: repeat_times is a list (with tensor) @@ -229,10 +242,10 @@ def setUp(self): self.if_enable_cinn() def if_enable_cinn(self): - self.enable_cinn = True + self.check_cinn = True def test_check_output(self): - self.check_output(check_cinn=self.enable_cinn) + self.check_output(check_cinn=self.check_cinn) class TestTileFP16OP(OpTest): @@ -251,7 +264,7 @@ def setUp(self): self.if_enable_cinn() def if_enable_cinn(self): - self.enable_cinn = True + self.check_cinn = True def init_data(self): self.dtype = np.float16 @@ -259,7 +272,7 @@ def init_data(self): self.repeat_times = [2, 1, 4] def test_check_output(self): - self.check_output(check_cinn=self.enable_cinn) + self.check_output(check_cinn=self.check_cinn) def test_check_grad(self): self.check_grad(['X'], 'Out', check_prim=True) @@ -286,11 +299,11 @@ def setUp(self): self.if_enable_cinn() def if_enable_cinn(self): - self.enable_cinn = True + self.check_cinn = True def test_check_output(self): place = core.CUDAPlace(0) - self.check_output_with_place(place, check_cinn=self.enable_cinn) + self.check_output_with_place(place, check_cinn=self.check_cinn) def init_data(self): self.dtype = np.uint16 @@ -314,10 +327,10 @@ def setUp(self): self.if_enable_cinn() def if_enable_cinn(self): - self.enable_cinn = True + self.check_cinn = True def test_check_output(self): - self.check_output(check_cinn=self.enable_cinn) + self.check_output(check_cinn=self.check_cinn) # Situation 56: input x is Integer @@ -334,10 +347,10 @@ def setUp(self): self.if_enable_cinn() def if_enable_cinn(self): - self.enable_cinn = True + self.check_cinn = True def test_check_output(self): - self.check_output(check_cinn=self.enable_cinn) + self.check_output(check_cinn=self.check_cinn) class TestTileError(unittest.TestCase): diff --git a/test/legacy_test/test_top_k_op.py b/test/legacy_test/test_top_k_op.py index 814a014baff5d..940db2bb899f8 100644 --- a/test/legacy_test/test_top_k_op.py +++ b/test/legacy_test/test_top_k_op.py @@ -26,7 +26,7 @@ def setUp(self): self.set_args() self.op_type = "top_k" self.dtype = np.float64 - self.enable_cinn = True + self.check_cinn = True self.init_dtype() k = self.top_k @@ -55,10 +55,10 @@ def set_args(self): self.top_k = 1 def test_check_output(self): - self.check_output(check_cinn=self.enable_cinn) + self.check_output(check_cinn=self.check_cinn) def test_check_grad(self): - self.check_grad({'X'}, 'Out', check_cinn=self.enable_cinn) + self.check_grad({'X'}, 'Out', check_cinn=self.check_cinn) if __name__ == "__main__": diff --git a/test/legacy_test/test_where_op.py b/test/legacy_test/test_where_op.py index d4608a5925afa..b68afe65c3a08 100644 --- a/test/legacy_test/test_where_op.py +++ b/test/legacy_test/test_where_op.py @@ -27,16 +27,16 @@ class TestWhereOp(OpTest): def setUp(self): self.op_type = 'where' self.python_api = paddle.where - self.enable_cinn = True + self.check_cinn = True self.init_config() self.inputs = {'Condition': self.cond, 'X': self.x, 'Y': self.y} self.outputs = {'Out': np.where(self.cond, self.x, self.y)} def test_check_output(self): - self.check_output(check_cinn=self.enable_cinn) + self.check_output(check_cinn=self.check_cinn) def test_check_grad(self): - self.check_grad(['X', 'Y'], 'Out', check_cinn=self.enable_cinn) + self.check_grad(['X', 'Y'], 'Out', check_cinn=self.check_cinn) def init_config(self): self.x = np.random.uniform((-3), 5, 100).astype('float64') @@ -69,7 +69,7 @@ def setUp(self): self.op_type = 'where' self.dtype = np.uint16 self.python_api = paddle.where - self.enable_cinn = True + self.check_cinn = True self.init_config() self.inputs = { 'Condition': self.cond, @@ -82,7 +82,7 @@ def setUp(self): def test_check_output(self): place = core.CUDAPlace(0) - self.check_output_with_place(place, check_cinn=self.enable_cinn) + self.check_output_with_place(place, check_cinn=self.check_cinn) def test_check_grad(self): place = core.CUDAPlace(0) @@ -91,7 +91,7 @@ def test_check_grad(self): ['X', 'Y'], 'Out', numeric_grad_delta=0.05, - check_cinn=self.enable_cinn, + check_cinn=self.check_cinn, ) def init_config(self): From e3457b03f598231c2b2f2f950cd7686a6ce07257 Mon Sep 17 00:00:00 2001 From: Fisher Date: Fri, 9 Jun 2023 08:58:28 +0000 Subject: [PATCH 11/12] Revert pool2d test timeout --- test/legacy_test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/legacy_test/CMakeLists.txt b/test/legacy_test/CMakeLists.txt index 30c1412e89bf9..2749c3576fa62 100644 --- a/test/legacy_test/CMakeLists.txt +++ b/test/legacy_test/CMakeLists.txt @@ -1035,7 +1035,7 @@ set_tests_properties(test_program_prune_backward PROPERTIES TIMEOUT 120) set_tests_properties(test_group_norm_op PROPERTIES TIMEOUT 120) set_tests_properties(test_imperative_optimizer PROPERTIES TIMEOUT 250) set_tests_properties(test_imperative_optimizer_v2 PROPERTIES TIMEOUT 250) -set_tests_properties(test_pool2d_op PROPERTIES TIMEOUT 200) +set_tests_properties(test_pool2d_op PROPERTIES TIMEOUT 120) set_tests_properties(test_transpose_op PROPERTIES TIMEOUT 120) set_tests_properties(test_activation_op PROPERTIES TIMEOUT 270) set_tests_properties(test_normal PROPERTIES TIMEOUT 120) From 8eee9f9bbc9b8af22212373dab098a41106e4ab9 Mon Sep 17 00:00:00 2001 From: Fisher Date: Mon, 12 Jun 2023 03:15:34 +0000 Subject: [PATCH 12/12] Remove check_prim and use enable_cinn --- test/legacy_test/test_tile_op.py | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/test/legacy_test/test_tile_op.py b/test/legacy_test/test_tile_op.py index ed463afaf014d..ab8d289aeae03 100644 --- a/test/legacy_test/test_tile_op.py +++ b/test/legacy_test/test_tile_op.py @@ -33,7 +33,6 @@ def setUp(self): self.public_python_api = paddle.tile self.init_data() self.if_enable_cinn() - self.if_check_prim() self.inputs = {'X': np.random.random(self.ori_shape).astype("float64")} self.attrs = {'repeat_times': self.repeat_times} @@ -43,9 +42,6 @@ def setUp(self): def if_enable_cinn(self): self.check_cinn = True - def if_check_prim(self): - self.check_prim = True - def init_data(self): self.ori_shape = [100] self.repeat_times = [2] @@ -54,7 +50,7 @@ def test_check_output(self): self.check_output(check_cinn=self.check_cinn) def test_check_grad(self): - self.check_grad(['X'], 'Out', check_prim=self.check_prim) + self.check_grad(['X'], 'Out', check_prim=True) class TestTileOpRank_ZeroDim1(TestTileOpRank1): @@ -64,9 +60,7 @@ def init_data(self): def if_enable_cinn(self): self.check_cinn = False - - def if_check_prim(self): - self.check_prim = False + self.enable_cinn = False class TestTileOpRank_ZeroDim2(TestTileOpRank1): @@ -76,9 +70,7 @@ def init_data(self): def if_enable_cinn(self): self.check_cinn = False - - def if_check_prim(self): - self.check_prim = False + self.enable_cinn = False class TestTileOpRank_ZeroDim3(TestTileOpRank1): @@ -88,9 +80,7 @@ def init_data(self): def if_enable_cinn(self): self.check_cinn = False - - def if_check_prim(self): - self.check_prim = False + self.enable_cinn = False # with dimension expanding