From 88b986a67c1786b569814b2c1e41ff1173077337 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=A5=E4=B9=94?= <83450930+Liyulingyue@users.noreply.github.com> Date: Fri, 7 Jul 2023 16:21:03 +0800 Subject: [PATCH] [CodeStyle][CINN] ruff F401,F632,F811 in test/cinn (#55013) --- pyproject.toml | 3 --- test/cinn/auto_schedule/cost_model/test_cost_model.py | 1 - test/cinn/fake_model/naive_mul.py | 5 ----- test/cinn/fake_model/naive_multi_fc.py | 4 ---- test/cinn/fake_model/resnet_model.py | 5 ----- test/cinn/op_mappers/op_mapper_test.py | 5 ++--- test/cinn/op_mappers/test_argsort_op.py | 3 +-- test/cinn/op_mappers/test_assign_value_op.py | 4 +--- test/cinn/op_mappers/test_atan2_op.py | 3 +-- test/cinn/op_mappers/test_batch_norm_op.py | 3 +-- test/cinn/op_mappers/test_bitwise_op.py | 3 +-- test/cinn/op_mappers/test_compare_op.py | 3 +-- test/cinn/op_mappers/test_conv2d_op.py | 3 +-- test/cinn/op_mappers/test_cumsum_op.py | 3 +-- test/cinn/op_mappers/test_elementwise_op.py | 3 +-- test/cinn/op_mappers/test_expand_op.py | 3 +-- test/cinn/op_mappers/test_expand_v2_op.py | 3 +-- test/cinn/op_mappers/test_fill_constant_op.py | 2 +- test/cinn/op_mappers/test_gather_nd_op.py | 2 +- test/cinn/op_mappers/test_gather_op.py | 3 +-- test/cinn/op_mappers/test_gaussian_random_op.py | 5 +---- test/cinn/op_mappers/test_layer_norm_op.py | 4 +--- test/cinn/op_mappers/test_log1p_op.py | 3 +-- test/cinn/op_mappers/test_logical_op.py | 3 +-- test/cinn/op_mappers/test_lookup_table_op.py | 3 +-- test/cinn/op_mappers/test_mul_op.py | 3 +-- test/cinn/op_mappers/test_norm_op.py | 3 +-- test/cinn/op_mappers/test_one_hot_op.py | 3 +-- test/cinn/op_mappers/test_pow_op.py | 3 +-- test/cinn/op_mappers/test_randint_op.py | 5 +---- test/cinn/op_mappers/test_reduce_op.py | 3 +-- test/cinn/op_mappers/test_roll_op.py | 2 +- test/cinn/op_mappers/test_scale_op.py | 3 +-- test/cinn/op_mappers/test_sign_op.py | 2 +- test/cinn/op_mappers/test_split_op.py | 3 +-- test/cinn/op_mappers/test_squeeze_op.py | 3 +-- test/cinn/op_mappers/test_stack_op.py | 3 +-- test/cinn/op_mappers/test_strided_slice_op.py | 3 +-- test/cinn/op_mappers/test_tile_op.py | 2 +- test/cinn/op_mappers/test_transpose2_op.py | 3 +-- test/cinn/op_mappers/test_unary_op.py | 2 +- test/cinn/op_mappers/test_uniform_random_op.py | 5 +---- test/cinn/op_mappers/test_where_op.py | 3 +-- test/cinn/ops/op_test.py | 2 -- test/cinn/ops/test_abs_op.py | 1 - test/cinn/ops/test_acos_op.py | 3 --- test/cinn/ops/test_acosh_op.py | 3 --- test/cinn/ops/test_asin_op.py | 2 -- test/cinn/ops/test_asinh_op.py | 3 --- test/cinn/ops/test_atan_op.py | 3 --- test/cinn/ops/test_atanh_op.py | 3 --- test/cinn/ops/test_batch_norm_op.py | 4 ---- test/cinn/ops/test_binary_elementwise_op.py | 1 - test/cinn/ops/test_bitcast_convert_op.py | 1 - test/cinn/ops/test_broadcast_to_op.py | 4 +--- test/cinn/ops/test_cast_op.py | 3 --- test/cinn/ops/test_conv2d_op.py | 3 --- test/cinn/ops/test_cos_op.py | 2 -- test/cinn/ops/test_cosh_op.py | 2 -- test/cinn/ops/test_depthwise_conv2d_op.py | 1 - test/cinn/ops/test_divide_op.py | 2 +- test/cinn/ops/test_dropout_infer_op.py | 7 ++----- test/cinn/ops/test_erf_op.py | 2 -- test/cinn/ops/test_exp_op.py | 2 -- test/cinn/ops/test_floor_divide_op.py | 4 ---- test/cinn/ops/test_floor_op.py | 2 -- test/cinn/ops/test_gather_nd_op.py | 1 - test/cinn/ops/test_gather_op.py | 3 --- test/cinn/ops/test_gaussian_random_op.py | 1 - test/cinn/ops/test_gelu_op.py | 3 --- test/cinn/ops/test_identity_op.py | 1 - test/cinn/ops/test_is_finite_op.py | 1 - test/cinn/ops/test_is_inf_op.py | 1 - test/cinn/ops/test_is_nan_op.py | 1 - test/cinn/ops/test_isclose_op.py | 1 - test/cinn/ops/test_left_shift_op.py | 2 -- test/cinn/ops/test_log_op.py | 1 - test/cinn/ops/test_logical_and_op.py | 2 -- test/cinn/ops/test_logical_not_op.py | 3 --- test/cinn/ops/test_logical_or_op.py | 2 -- test/cinn/ops/test_logical_right_shift_op.py | 1 - test/cinn/ops/test_logical_xor_op.py | 2 -- test/cinn/ops/test_lookup_table_op.py | 1 - test/cinn/ops/test_matmul_op.py | 4 ---- test/cinn/ops/test_mod_op.py | 3 --- test/cinn/ops/test_negative_op.py | 2 -- test/cinn/ops/test_one_hot_op.py | 3 --- test/cinn/ops/test_pow_op.py | 1 - test/cinn/ops/test_randint_op.py | 3 --- test/cinn/ops/test_reciprocal_op.py | 4 +--- test/cinn/ops/test_reduce_op.py | 1 - test/cinn/ops/test_reduce_op_new.py | 3 --- test/cinn/ops/test_relu6_op.py | 3 --- test/cinn/ops/test_remainder_op.py | 1 - test/cinn/ops/test_resize_op.py | 7 ------- test/cinn/ops/test_right_shift_op.py | 2 -- test/cinn/ops/test_round_op.py | 1 - test/cinn/ops/test_rsqrt_op.py | 2 -- test/cinn/ops/test_scale_op.py | 3 --- test/cinn/ops/test_sin_op.py | 2 -- test/cinn/ops/test_sinh_op.py | 2 -- test/cinn/ops/test_sqrt_op.py | 2 -- test/cinn/ops/test_tan_op.py | 2 -- test/cinn/ops/test_tanh_op.py | 2 -- test/cinn/ops/test_trunc_op.py | 2 -- test/cinn/ops/test_unary_elementwise_op.py | 1 - test/cinn/ops/test_uniform_random_op.py | 1 - test/cinn/ops/test_zero_dim_tensor.py | 1 - test/cinn/passes/pass_test.py | 7 +------ test/cinn/test_common.py | 2 -- test/cinn/test_computation.py | 2 -- test/cinn/test_efficientnet.py | 3 --- test/cinn/test_facedet.py | 3 --- test/cinn/test_frontend.py | 3 --- test/cinn/test_ir.py | 2 -- test/cinn/test_mobilenetv1.py | 3 --- test/cinn/test_mobilenetv2.py | 3 --- test/cinn/test_netbuilder.py | 2 -- test/cinn/test_op_benchmark.py | 6 ++---- test/cinn/test_op_broadcast.py | 7 +------ test/cinn/test_op_nn.py | 7 +------ test/cinn/test_op_transform.py | 7 +------ test/cinn/test_packed_func.py | 3 +-- test/cinn/test_paddle_model_convertor.py | 7 +------ test/cinn/test_pe_elementwise.py | 1 - test/cinn/test_resnet.py | 3 --- test/cinn/test_resnet18.py | 3 --- test/cinn/test_resnet50.py | 3 --- test/cinn/test_squeezenet.py | 3 --- test/cinn/test_utils.py | 4 +--- 130 files changed, 53 insertions(+), 312 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index ac34fef75fd..6ab8c3fd1df 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -103,8 +103,5 @@ ignore = [ "F403", ] "test/cinn/**" = [ - "F401", "F403", - "F632", - "F811", ] diff --git a/test/cinn/auto_schedule/cost_model/test_cost_model.py b/test/cinn/auto_schedule/cost_model/test_cost_model.py index 76ed6e2feda..12db8f8ccbe 100644 --- a/test/cinn/auto_schedule/cost_model/test_cost_model.py +++ b/test/cinn/auto_schedule/cost_model/test_cost_model.py @@ -16,7 +16,6 @@ import os import shutil import unittest -import cinn import numpy as np from cinn.auto_schedule.cost_model import CostModel diff --git a/test/cinn/fake_model/naive_mul.py b/test/cinn/fake_model/naive_mul.py index 0452f41a16c..5601613a6b0 100644 --- a/test/cinn/fake_model/naive_mul.py +++ b/test/cinn/fake_model/naive_mul.py @@ -12,11 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os -import sys - -import numpy -import numpy as np import paddle from paddle import fluid, static diff --git a/test/cinn/fake_model/naive_multi_fc.py b/test/cinn/fake_model/naive_multi_fc.py index 7d7995bbb25..2d417a428fa 100644 --- a/test/cinn/fake_model/naive_multi_fc.py +++ b/test/cinn/fake_model/naive_multi_fc.py @@ -14,11 +14,7 @@ """ A fake model with multiple FC layers to test CINN on a more complex model. """ -import os -import sys -import numpy -import numpy as np import paddle from paddle import fluid, static diff --git a/test/cinn/fake_model/resnet_model.py b/test/cinn/fake_model/resnet_model.py index aa18fa49361..6871d03a9ae 100644 --- a/test/cinn/fake_model/resnet_model.py +++ b/test/cinn/fake_model/resnet_model.py @@ -12,11 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os -import sys - -import numpy -import numpy as np import paddle from paddle import fluid, static diff --git a/test/cinn/op_mappers/op_mapper_test.py b/test/cinn/op_mappers/op_mapper_test.py index 978fc132dc6..2e277bd879b 100644 --- a/test/cinn/op_mappers/op_mapper_test.py +++ b/test/cinn/op_mappers/op_mapper_test.py @@ -17,18 +17,17 @@ import logging import os import sys -from ast import arg from cinn.common import is_compiled_with_cuda from cinn.framework import Scope -from cinn.frontend import NetBuilder, PaddleModelConvertor +from cinn.frontend import PaddleModelConvertor import paddle from paddle.fluid.layer_helper import LayerHelper from paddle.static import Variable as PaddleVariable sys.path.append("/work/dev_CINN/build/python/tests") -from test.cinn.ops.op_test import OpTest, OpTestTool +from test.cinn.ops.op_test import OpTest logging.basicConfig(level=os.environ.get('LOG_LEVEL', 'INFO').upper()) logger = logging.getLogger(name="op_test") diff --git a/test/cinn/op_mappers/test_argsort_op.py b/test/cinn/op_mappers/test_argsort_op.py index a4aad29a4c6..492f97307df 100644 --- a/test/cinn/op_mappers/test_argsort_op.py +++ b/test/cinn/op_mappers/test_argsort_op.py @@ -16,8 +16,7 @@ import unittest -import numpy as np -from op_mapper_test import OpMapperTest, logger +from op_mapper_test import OpMapperTest import paddle diff --git a/test/cinn/op_mappers/test_assign_value_op.py b/test/cinn/op_mappers/test_assign_value_op.py index a185cedbe55..b5d8f4ceb33 100644 --- a/test/cinn/op_mappers/test_assign_value_op.py +++ b/test/cinn/op_mappers/test_assign_value_op.py @@ -17,9 +17,7 @@ import unittest import numpy as np -from op_mapper_test import OpMapperTest, logger - -import paddle +from op_mapper_test import OpMapperTest class TestAssignValueOp(OpMapperTest): diff --git a/test/cinn/op_mappers/test_atan2_op.py b/test/cinn/op_mappers/test_atan2_op.py index 65e635c349b..1f18eb71414 100644 --- a/test/cinn/op_mappers/test_atan2_op.py +++ b/test/cinn/op_mappers/test_atan2_op.py @@ -16,8 +16,7 @@ import unittest -import numpy as np -from op_mapper_test import OpMapperTest, logger +from op_mapper_test import OpMapperTest import paddle diff --git a/test/cinn/op_mappers/test_batch_norm_op.py b/test/cinn/op_mappers/test_batch_norm_op.py index 88490102c23..f4496e21265 100644 --- a/test/cinn/op_mappers/test_batch_norm_op.py +++ b/test/cinn/op_mappers/test_batch_norm_op.py @@ -16,8 +16,7 @@ import unittest -import numpy as np -from op_mapper_test import OpMapperTest, logger +from op_mapper_test import OpMapperTest import paddle diff --git a/test/cinn/op_mappers/test_bitwise_op.py b/test/cinn/op_mappers/test_bitwise_op.py index 309fcf9a629..2ad1df4178b 100644 --- a/test/cinn/op_mappers/test_bitwise_op.py +++ b/test/cinn/op_mappers/test_bitwise_op.py @@ -16,8 +16,7 @@ import unittest -import numpy as np -from op_mapper_test import OpMapperTest, logger +from op_mapper_test import OpMapperTest import paddle diff --git a/test/cinn/op_mappers/test_compare_op.py b/test/cinn/op_mappers/test_compare_op.py index 5a30a5e9a57..7f13dfbb1da 100644 --- a/test/cinn/op_mappers/test_compare_op.py +++ b/test/cinn/op_mappers/test_compare_op.py @@ -16,8 +16,7 @@ import unittest -import numpy as np -from op_mapper_test import OpMapperTest, logger +from op_mapper_test import OpMapperTest import paddle diff --git a/test/cinn/op_mappers/test_conv2d_op.py b/test/cinn/op_mappers/test_conv2d_op.py index 15466b8160e..476edea4456 100644 --- a/test/cinn/op_mappers/test_conv2d_op.py +++ b/test/cinn/op_mappers/test_conv2d_op.py @@ -16,8 +16,7 @@ import unittest -import numpy as np -from op_mapper_test import OpMapperTest, logger +from op_mapper_test import OpMapperTest import paddle diff --git a/test/cinn/op_mappers/test_cumsum_op.py b/test/cinn/op_mappers/test_cumsum_op.py index ec817f86f2a..8245f7aa1b8 100644 --- a/test/cinn/op_mappers/test_cumsum_op.py +++ b/test/cinn/op_mappers/test_cumsum_op.py @@ -16,8 +16,7 @@ import unittest -import numpy as np -from op_mapper_test import OpMapperTest, logger +from op_mapper_test import OpMapperTest import paddle diff --git a/test/cinn/op_mappers/test_elementwise_op.py b/test/cinn/op_mappers/test_elementwise_op.py index b021dbcce8c..4d019678c14 100644 --- a/test/cinn/op_mappers/test_elementwise_op.py +++ b/test/cinn/op_mappers/test_elementwise_op.py @@ -16,8 +16,7 @@ import unittest -import numpy as np -from op_mapper_test import OpMapperTest, logger +from op_mapper_test import OpMapperTest import paddle diff --git a/test/cinn/op_mappers/test_expand_op.py b/test/cinn/op_mappers/test_expand_op.py index 59f917fcb75..f563cf62fca 100644 --- a/test/cinn/op_mappers/test_expand_op.py +++ b/test/cinn/op_mappers/test_expand_op.py @@ -16,8 +16,7 @@ import unittest -import numpy as np -from op_mapper_test import OpMapperTest, logger +from op_mapper_test import OpMapperTest import paddle diff --git a/test/cinn/op_mappers/test_expand_v2_op.py b/test/cinn/op_mappers/test_expand_v2_op.py index d82cb80a308..13e8af2eba6 100644 --- a/test/cinn/op_mappers/test_expand_v2_op.py +++ b/test/cinn/op_mappers/test_expand_v2_op.py @@ -16,8 +16,7 @@ import unittest -import numpy as np -from op_mapper_test import OpMapperTest, logger +from op_mapper_test import OpMapperTest import paddle diff --git a/test/cinn/op_mappers/test_fill_constant_op.py b/test/cinn/op_mappers/test_fill_constant_op.py index fb083e86440..69d71441d27 100644 --- a/test/cinn/op_mappers/test_fill_constant_op.py +++ b/test/cinn/op_mappers/test_fill_constant_op.py @@ -17,7 +17,7 @@ import unittest import numpy as np -from op_mapper_test import OpMapperTest, logger +from op_mapper_test import OpMapperTest import paddle diff --git a/test/cinn/op_mappers/test_gather_nd_op.py b/test/cinn/op_mappers/test_gather_nd_op.py index ee3458cd89d..f0e68a4a926 100644 --- a/test/cinn/op_mappers/test_gather_nd_op.py +++ b/test/cinn/op_mappers/test_gather_nd_op.py @@ -17,7 +17,7 @@ import unittest import numpy as np -from op_mapper_test import OpMapperTest, logger +from op_mapper_test import OpMapperTest import paddle diff --git a/test/cinn/op_mappers/test_gather_op.py b/test/cinn/op_mappers/test_gather_op.py index 631d155b07e..e4c156a2bec 100644 --- a/test/cinn/op_mappers/test_gather_op.py +++ b/test/cinn/op_mappers/test_gather_op.py @@ -16,8 +16,7 @@ import unittest -import numpy as np -from op_mapper_test import OpMapperTest, logger +from op_mapper_test import OpMapperTest import paddle diff --git a/test/cinn/op_mappers/test_gaussian_random_op.py b/test/cinn/op_mappers/test_gaussian_random_op.py index ebd02eeb1d1..de3b64e7ecb 100644 --- a/test/cinn/op_mappers/test_gaussian_random_op.py +++ b/test/cinn/op_mappers/test_gaussian_random_op.py @@ -16,10 +16,7 @@ import unittest -import numpy as np -from op_mapper_test import OpMapperTest, logger - -import paddle +from op_mapper_test import OpMapperTest class TestGaussianRandomOp(OpMapperTest): diff --git a/test/cinn/op_mappers/test_layer_norm_op.py b/test/cinn/op_mappers/test_layer_norm_op.py index 98f8549da81..6a8c9451bad 100644 --- a/test/cinn/op_mappers/test_layer_norm_op.py +++ b/test/cinn/op_mappers/test_layer_norm_op.py @@ -14,11 +14,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -import functools import unittest -import numpy as np -from op_mapper_test import OpMapperTest, logger +from op_mapper_test import OpMapperTest import paddle diff --git a/test/cinn/op_mappers/test_log1p_op.py b/test/cinn/op_mappers/test_log1p_op.py index 9ed8a830b19..c59bcbc8aa8 100644 --- a/test/cinn/op_mappers/test_log1p_op.py +++ b/test/cinn/op_mappers/test_log1p_op.py @@ -16,8 +16,7 @@ import unittest -import numpy as np -from op_mapper_test import OpMapperTest, logger +from op_mapper_test import OpMapperTest import paddle diff --git a/test/cinn/op_mappers/test_logical_op.py b/test/cinn/op_mappers/test_logical_op.py index 9b0f95b4d3c..524dd982827 100644 --- a/test/cinn/op_mappers/test_logical_op.py +++ b/test/cinn/op_mappers/test_logical_op.py @@ -16,8 +16,7 @@ import unittest -import numpy as np -from op_mapper_test import OpMapperTest, logger +from op_mapper_test import OpMapperTest import paddle diff --git a/test/cinn/op_mappers/test_lookup_table_op.py b/test/cinn/op_mappers/test_lookup_table_op.py index bbeac7a6cf3..0d3f898df2a 100644 --- a/test/cinn/op_mappers/test_lookup_table_op.py +++ b/test/cinn/op_mappers/test_lookup_table_op.py @@ -14,8 +14,7 @@ import unittest -import numpy as np -from op_mapper_test import OpMapperTest, logger +from op_mapper_test import OpMapperTest import paddle diff --git a/test/cinn/op_mappers/test_mul_op.py b/test/cinn/op_mappers/test_mul_op.py index 2a35177e874..8726efc5aeb 100644 --- a/test/cinn/op_mappers/test_mul_op.py +++ b/test/cinn/op_mappers/test_mul_op.py @@ -16,8 +16,7 @@ import unittest -import numpy as np -from op_mapper_test import OpMapperTest, logger +from op_mapper_test import OpMapperTest import paddle diff --git a/test/cinn/op_mappers/test_norm_op.py b/test/cinn/op_mappers/test_norm_op.py index d48ba95d325..a163925f2bc 100644 --- a/test/cinn/op_mappers/test_norm_op.py +++ b/test/cinn/op_mappers/test_norm_op.py @@ -16,8 +16,7 @@ import unittest -import numpy as np -from op_mapper_test import OpMapperTest, logger +from op_mapper_test import OpMapperTest import paddle diff --git a/test/cinn/op_mappers/test_one_hot_op.py b/test/cinn/op_mappers/test_one_hot_op.py index c323e138f7b..2735af7e699 100644 --- a/test/cinn/op_mappers/test_one_hot_op.py +++ b/test/cinn/op_mappers/test_one_hot_op.py @@ -14,8 +14,7 @@ import unittest -import numpy as np -from op_mapper_test import OpMapperTest, logger +from op_mapper_test import OpMapperTest import paddle diff --git a/test/cinn/op_mappers/test_pow_op.py b/test/cinn/op_mappers/test_pow_op.py index b60727d746c..ea30319491a 100644 --- a/test/cinn/op_mappers/test_pow_op.py +++ b/test/cinn/op_mappers/test_pow_op.py @@ -16,8 +16,7 @@ import unittest -import numpy as np -from op_mapper_test import OpMapperTest, logger +from op_mapper_test import OpMapperTest import paddle diff --git a/test/cinn/op_mappers/test_randint_op.py b/test/cinn/op_mappers/test_randint_op.py index e626e29a213..f2e87417779 100644 --- a/test/cinn/op_mappers/test_randint_op.py +++ b/test/cinn/op_mappers/test_randint_op.py @@ -16,10 +16,7 @@ import unittest -import numpy as np -from op_mapper_test import OpMapperTest, logger - -import paddle +from op_mapper_test import OpMapperTest class TestRandIntOp(OpMapperTest): diff --git a/test/cinn/op_mappers/test_reduce_op.py b/test/cinn/op_mappers/test_reduce_op.py index 3a1d4738929..a39acd8c163 100644 --- a/test/cinn/op_mappers/test_reduce_op.py +++ b/test/cinn/op_mappers/test_reduce_op.py @@ -16,8 +16,7 @@ import unittest -import numpy as np -from op_mapper_test import OpMapperTest, logger +from op_mapper_test import OpMapperTest import paddle diff --git a/test/cinn/op_mappers/test_roll_op.py b/test/cinn/op_mappers/test_roll_op.py index 6eaa6bf054a..a90942fed8e 100644 --- a/test/cinn/op_mappers/test_roll_op.py +++ b/test/cinn/op_mappers/test_roll_op.py @@ -17,7 +17,7 @@ import unittest import numpy as np -from op_mapper_test import OpMapperTest, logger +from op_mapper_test import OpMapperTest import paddle diff --git a/test/cinn/op_mappers/test_scale_op.py b/test/cinn/op_mappers/test_scale_op.py index d15c1ff4e28..9f029ae3faf 100644 --- a/test/cinn/op_mappers/test_scale_op.py +++ b/test/cinn/op_mappers/test_scale_op.py @@ -16,8 +16,7 @@ import unittest -import numpy as np -from op_mapper_test import OpMapperTest, logger +from op_mapper_test import OpMapperTest import paddle diff --git a/test/cinn/op_mappers/test_sign_op.py b/test/cinn/op_mappers/test_sign_op.py index c732aaaa229..cb1995f6f9b 100644 --- a/test/cinn/op_mappers/test_sign_op.py +++ b/test/cinn/op_mappers/test_sign_op.py @@ -17,7 +17,7 @@ import unittest import numpy as np -from op_mapper_test import OpMapperTest, logger +from op_mapper_test import OpMapperTest import paddle diff --git a/test/cinn/op_mappers/test_split_op.py b/test/cinn/op_mappers/test_split_op.py index e73f1302ee6..2f82ea5f33b 100644 --- a/test/cinn/op_mappers/test_split_op.py +++ b/test/cinn/op_mappers/test_split_op.py @@ -16,8 +16,7 @@ import unittest -import numpy as np -from op_mapper_test import OpMapperTest, logger +from op_mapper_test import OpMapperTest import paddle diff --git a/test/cinn/op_mappers/test_squeeze_op.py b/test/cinn/op_mappers/test_squeeze_op.py index 7acb33c029a..1381101242e 100644 --- a/test/cinn/op_mappers/test_squeeze_op.py +++ b/test/cinn/op_mappers/test_squeeze_op.py @@ -16,8 +16,7 @@ import unittest -import numpy as np -from op_mapper_test import OpMapperTest, logger +from op_mapper_test import OpMapperTest import paddle diff --git a/test/cinn/op_mappers/test_stack_op.py b/test/cinn/op_mappers/test_stack_op.py index 06cb4bf6e7b..1592476c9a0 100644 --- a/test/cinn/op_mappers/test_stack_op.py +++ b/test/cinn/op_mappers/test_stack_op.py @@ -16,8 +16,7 @@ import unittest -import numpy as np -from op_mapper_test import OpMapperTest, logger +from op_mapper_test import OpMapperTest import paddle diff --git a/test/cinn/op_mappers/test_strided_slice_op.py b/test/cinn/op_mappers/test_strided_slice_op.py index 2f1fb248ad8..598944e9279 100644 --- a/test/cinn/op_mappers/test_strided_slice_op.py +++ b/test/cinn/op_mappers/test_strided_slice_op.py @@ -16,8 +16,7 @@ import unittest -import numpy as np -from op_mapper_test import OpMapperTest, logger +from op_mapper_test import OpMapperTest import paddle diff --git a/test/cinn/op_mappers/test_tile_op.py b/test/cinn/op_mappers/test_tile_op.py index 75b04947a0e..fc40359de57 100644 --- a/test/cinn/op_mappers/test_tile_op.py +++ b/test/cinn/op_mappers/test_tile_op.py @@ -17,7 +17,7 @@ import unittest import numpy as np -from op_mapper_test import OpMapperTest, logger +from op_mapper_test import OpMapperTest import paddle diff --git a/test/cinn/op_mappers/test_transpose2_op.py b/test/cinn/op_mappers/test_transpose2_op.py index 6b47934a3ba..12e6ccca722 100644 --- a/test/cinn/op_mappers/test_transpose2_op.py +++ b/test/cinn/op_mappers/test_transpose2_op.py @@ -16,8 +16,7 @@ import unittest -import numpy as np -from op_mapper_test import OpMapperTest, logger +from op_mapper_test import OpMapperTest import paddle diff --git a/test/cinn/op_mappers/test_unary_op.py b/test/cinn/op_mappers/test_unary_op.py index b6b5fb8bf11..0d019d679fc 100644 --- a/test/cinn/op_mappers/test_unary_op.py +++ b/test/cinn/op_mappers/test_unary_op.py @@ -17,7 +17,7 @@ import unittest import numpy as np -from op_mapper_test import OpMapperTest, logger +from op_mapper_test import OpMapperTest import paddle diff --git a/test/cinn/op_mappers/test_uniform_random_op.py b/test/cinn/op_mappers/test_uniform_random_op.py index f4fd37b7182..fae8b61956b 100644 --- a/test/cinn/op_mappers/test_uniform_random_op.py +++ b/test/cinn/op_mappers/test_uniform_random_op.py @@ -16,10 +16,7 @@ import unittest -import numpy as np -from op_mapper_test import OpMapperTest, logger - -import paddle +from op_mapper_test import OpMapperTest class TestUniformRandomOp(OpMapperTest): diff --git a/test/cinn/op_mappers/test_where_op.py b/test/cinn/op_mappers/test_where_op.py index 4398e9e6af9..766470ff573 100644 --- a/test/cinn/op_mappers/test_where_op.py +++ b/test/cinn/op_mappers/test_where_op.py @@ -16,8 +16,7 @@ import unittest -import numpy as np -from op_mapper_test import OpMapperTest, logger +from op_mapper_test import OpMapperTest import paddle diff --git a/test/cinn/ops/op_test.py b/test/cinn/ops/op_test.py index d0952caef29..02071655bd6 100755 --- a/test/cinn/ops/op_test.py +++ b/test/cinn/ops/op_test.py @@ -16,10 +16,8 @@ import logging import os import struct import unittest -from contextlib import contextmanager import numpy as np -from cinn import Target from cinn.common import * from cinn.frontend import * from cinn.runtime import seed as cinn_seed diff --git a/test/cinn/ops/test_abs_op.py b/test/cinn/ops/test_abs_op.py index 10f12c2b9e7..e5f1dfee234 100644 --- a/test/cinn/ops/test_abs_op.py +++ b/test/cinn/ops/test_abs_op.py @@ -14,7 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest from cinn.common import * from cinn.frontend import * diff --git a/test/cinn/ops/test_acos_op.py b/test/cinn/ops/test_acos_op.py index afb692c6d8a..637d4eb7b17 100644 --- a/test/cinn/ops/test_acos_op.py +++ b/test/cinn/ops/test_acos_op.py @@ -12,10 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest -import cinn -import numpy as np from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool diff --git a/test/cinn/ops/test_acosh_op.py b/test/cinn/ops/test_acosh_op.py index 0e3cd2b3300..2d87221f141 100644 --- a/test/cinn/ops/test_acosh_op.py +++ b/test/cinn/ops/test_acosh_op.py @@ -12,10 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest -import cinn -import numpy as np from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool diff --git a/test/cinn/ops/test_asin_op.py b/test/cinn/ops/test_asin_op.py index 11426a57e8a..691efd004b9 100644 --- a/test/cinn/ops/test_asin_op.py +++ b/test/cinn/ops/test_asin_op.py @@ -14,8 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import cinn -import numpy as np from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool diff --git a/test/cinn/ops/test_asinh_op.py b/test/cinn/ops/test_asinh_op.py index 7622c34d085..565ba8627ae 100644 --- a/test/cinn/ops/test_asinh_op.py +++ b/test/cinn/ops/test_asinh_op.py @@ -12,10 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest -import cinn -import numpy as np from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool diff --git a/test/cinn/ops/test_atan_op.py b/test/cinn/ops/test_atan_op.py index 81574ebe20a..6b3a832407e 100644 --- a/test/cinn/ops/test_atan_op.py +++ b/test/cinn/ops/test_atan_op.py @@ -12,10 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest -import cinn -import numpy as np from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool diff --git a/test/cinn/ops/test_atanh_op.py b/test/cinn/ops/test_atanh_op.py index b53fee7a96a..a7d92572acc 100644 --- a/test/cinn/ops/test_atanh_op.py +++ b/test/cinn/ops/test_atanh_op.py @@ -12,10 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest -import cinn -import numpy as np from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool diff --git a/test/cinn/ops/test_batch_norm_op.py b/test/cinn/ops/test_batch_norm_op.py index 8c57a9cd88d..052352f810f 100644 --- a/test/cinn/ops/test_batch_norm_op.py +++ b/test/cinn/ops/test_batch_norm_op.py @@ -14,11 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import sys -import unittest -import cinn -import numpy as np from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool diff --git a/test/cinn/ops/test_binary_elementwise_op.py b/test/cinn/ops/test_binary_elementwise_op.py index 045785982fc..475ca5c1825 100644 --- a/test/cinn/ops/test_binary_elementwise_op.py +++ b/test/cinn/ops/test_binary_elementwise_op.py @@ -16,7 +16,6 @@ import unittest -import cinn import numpy as np from cinn.common import * from cinn.frontend import * diff --git a/test/cinn/ops/test_bitcast_convert_op.py b/test/cinn/ops/test_bitcast_convert_op.py index 30af48b8a24..8a5c7b0c2c0 100644 --- a/test/cinn/ops/test_bitcast_convert_op.py +++ b/test/cinn/ops/test_bitcast_convert_op.py @@ -15,7 +15,6 @@ import unittest from struct import pack, unpack -import cinn import numpy as np from cinn.common import * from cinn.frontend import * diff --git a/test/cinn/ops/test_broadcast_to_op.py b/test/cinn/ops/test_broadcast_to_op.py index 3536355ac69..550209d05ce 100644 --- a/test/cinn/ops/test_broadcast_to_op.py +++ b/test/cinn/ops/test_broadcast_to_op.py @@ -14,14 +14,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -import sys import unittest -import cinn import numpy as np from cinn.common import * from cinn.frontend import * -from op_test import OpTest, OpTestTool +from op_test import OpTest import paddle diff --git a/test/cinn/ops/test_cast_op.py b/test/cinn/ops/test_cast_op.py index 99a4a4f8630..e2b4dfa8f66 100644 --- a/test/cinn/ops/test_cast_op.py +++ b/test/cinn/ops/test_cast_op.py @@ -14,10 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest -import cinn -import numpy as np from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool diff --git a/test/cinn/ops/test_conv2d_op.py b/test/cinn/ops/test_conv2d_op.py index a9a83c101cf..4ce19366482 100755 --- a/test/cinn/ops/test_conv2d_op.py +++ b/test/cinn/ops/test_conv2d_op.py @@ -13,10 +13,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -import unittest -import cinn -import numpy as np from cinn.common import * from cinn.frontend import * from cinn.runtime import * diff --git a/test/cinn/ops/test_cos_op.py b/test/cinn/ops/test_cos_op.py index eef3c2d05ea..831247cca57 100644 --- a/test/cinn/ops/test_cos_op.py +++ b/test/cinn/ops/test_cos_op.py @@ -14,8 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import cinn -import numpy as np from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool diff --git a/test/cinn/ops/test_cosh_op.py b/test/cinn/ops/test_cosh_op.py index 672af4fca0a..f4c823265ff 100644 --- a/test/cinn/ops/test_cosh_op.py +++ b/test/cinn/ops/test_cosh_op.py @@ -14,8 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import cinn -import numpy as np from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool diff --git a/test/cinn/ops/test_depthwise_conv2d_op.py b/test/cinn/ops/test_depthwise_conv2d_op.py index 2819ed30fa5..a0ead5faeec 100644 --- a/test/cinn/ops/test_depthwise_conv2d_op.py +++ b/test/cinn/ops/test_depthwise_conv2d_op.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import cinn from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool diff --git a/test/cinn/ops/test_divide_op.py b/test/cinn/ops/test_divide_op.py index 3dc8cf74f0e..be1415c7f84 100644 --- a/test/cinn/ops/test_divide_op.py +++ b/test/cinn/ops/test_divide_op.py @@ -45,7 +45,7 @@ class TestDivOp(OpTest): ) # paddle.divide does not support zero division - if self.case["y_dtype"] is "int32" or self.case["y_dtype"] is "int64": + if self.case["y_dtype"] == "int32" or self.case["y_dtype"] == "int64": self.y_np[self.y_np == 0] = 1 def build_paddle_program(self, target): diff --git a/test/cinn/ops/test_dropout_infer_op.py b/test/cinn/ops/test_dropout_infer_op.py index b9bc5d9680b..19b54e9f39b 100644 --- a/test/cinn/ops/test_dropout_infer_op.py +++ b/test/cinn/ops/test_dropout_infer_op.py @@ -12,10 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest -import cinn -import numpy as np from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool @@ -40,9 +37,9 @@ class TestDropoutInferOp(OpTest): self.x_np = self.random( shape=self.case["x_shape"], dtype=self.case["x_dtype"] ) - if self.case["mode"] is 'upscale_in_train': + if self.case["mode"] == 'upscale_in_train': self.case["cinn_mode"] = 'upscale_in_train' - elif self.case["mode"] is 'downscale_in_infer': + elif self.case["mode"] == 'downscale_in_infer': self.case["cinn_mode"] = 'downgrade_in_infer' else: raise f"Unknown mode for dropout_infer: {self.case['mode']}" diff --git a/test/cinn/ops/test_erf_op.py b/test/cinn/ops/test_erf_op.py index 860c1a17de8..4b84570bd59 100644 --- a/test/cinn/ops/test_erf_op.py +++ b/test/cinn/ops/test_erf_op.py @@ -14,8 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import cinn -import numpy as np from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool diff --git a/test/cinn/ops/test_exp_op.py b/test/cinn/ops/test_exp_op.py index f25577d2868..3d378579a8a 100644 --- a/test/cinn/ops/test_exp_op.py +++ b/test/cinn/ops/test_exp_op.py @@ -14,8 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import cinn -import numpy as np from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool diff --git a/test/cinn/ops/test_floor_divide_op.py b/test/cinn/ops/test_floor_divide_op.py index bef6dba1455..a1445863059 100644 --- a/test/cinn/ops/test_floor_divide_op.py +++ b/test/cinn/ops/test_floor_divide_op.py @@ -14,17 +14,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest -import cinn -import numpy as np from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool from op_test_helper import TestCaseHelper import paddle -import paddle.nn.functional as F @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_floor_op.py b/test/cinn/ops/test_floor_op.py index 24bbbab3bf2..47b68e95e12 100644 --- a/test/cinn/ops/test_floor_op.py +++ b/test/cinn/ops/test_floor_op.py @@ -14,8 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import cinn -import numpy as np from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool diff --git a/test/cinn/ops/test_gather_nd_op.py b/test/cinn/ops/test_gather_nd_op.py index 477a03f2807..60e0e71675a 100644 --- a/test/cinn/ops/test_gather_nd_op.py +++ b/test/cinn/ops/test_gather_nd_op.py @@ -19,7 +19,6 @@ import os import unittest from itertools import product -import cinn import numpy as np from cinn.common import * from cinn.frontend import * diff --git a/test/cinn/ops/test_gather_op.py b/test/cinn/ops/test_gather_op.py index c0bb83f20ed..14658e756ce 100644 --- a/test/cinn/ops/test_gather_op.py +++ b/test/cinn/ops/test_gather_op.py @@ -16,10 +16,7 @@ import logging import os -import unittest -from itertools import product -import cinn import numpy as np from cinn.common import * from cinn.frontend import * diff --git a/test/cinn/ops/test_gaussian_random_op.py b/test/cinn/ops/test_gaussian_random_op.py index f62835ae811..10677ca62fd 100644 --- a/test/cinn/ops/test_gaussian_random_op.py +++ b/test/cinn/ops/test_gaussian_random_op.py @@ -14,7 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import cinn from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool diff --git a/test/cinn/ops/test_gelu_op.py b/test/cinn/ops/test_gelu_op.py index cd5971925de..df50c85ded8 100644 --- a/test/cinn/ops/test_gelu_op.py +++ b/test/cinn/ops/test_gelu_op.py @@ -14,10 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest -import cinn -import numpy as np from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool diff --git a/test/cinn/ops/test_identity_op.py b/test/cinn/ops/test_identity_op.py index 683625506db..dbf595a9222 100644 --- a/test/cinn/ops/test_identity_op.py +++ b/test/cinn/ops/test_identity_op.py @@ -14,7 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest from cinn.common import * from cinn.frontend import * diff --git a/test/cinn/ops/test_is_finite_op.py b/test/cinn/ops/test_is_finite_op.py index 12d64a0050f..a7a94de1f4d 100644 --- a/test/cinn/ops/test_is_finite_op.py +++ b/test/cinn/ops/test_is_finite_op.py @@ -14,7 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest import numpy as np from cinn.common import * diff --git a/test/cinn/ops/test_is_inf_op.py b/test/cinn/ops/test_is_inf_op.py index ad3248e2998..90ea69e4cc9 100644 --- a/test/cinn/ops/test_is_inf_op.py +++ b/test/cinn/ops/test_is_inf_op.py @@ -14,7 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest import numpy as np from cinn.common import * diff --git a/test/cinn/ops/test_is_nan_op.py b/test/cinn/ops/test_is_nan_op.py index bd0dfaa70ee..8ebe3bda8ef 100644 --- a/test/cinn/ops/test_is_nan_op.py +++ b/test/cinn/ops/test_is_nan_op.py @@ -14,7 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest import numpy as np from cinn.common import * diff --git a/test/cinn/ops/test_isclose_op.py b/test/cinn/ops/test_isclose_op.py index 73bf8a7f649..897a06c0f3e 100644 --- a/test/cinn/ops/test_isclose_op.py +++ b/test/cinn/ops/test_isclose_op.py @@ -14,7 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import cinn import numpy as np from cinn.common import * from cinn.frontend import * diff --git a/test/cinn/ops/test_left_shift_op.py b/test/cinn/ops/test_left_shift_op.py index 57eb693dbce..28f5b69853b 100644 --- a/test/cinn/ops/test_left_shift_op.py +++ b/test/cinn/ops/test_left_shift_op.py @@ -12,9 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest -import cinn import numpy as np from cinn.common import * from cinn.frontend import * diff --git a/test/cinn/ops/test_log_op.py b/test/cinn/ops/test_log_op.py index bb66e71f1b8..f2868b6f46d 100644 --- a/test/cinn/ops/test_log_op.py +++ b/test/cinn/ops/test_log_op.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import cinn from cinn.common import * from cinn.frontend import * from op_test import OpTest diff --git a/test/cinn/ops/test_logical_and_op.py b/test/cinn/ops/test_logical_and_op.py index b7fcf7c5461..dfb8cc18b30 100644 --- a/test/cinn/ops/test_logical_and_op.py +++ b/test/cinn/ops/test_logical_and_op.py @@ -12,9 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest -import cinn import numpy as np from cinn.common import * from cinn.frontend import * diff --git a/test/cinn/ops/test_logical_not_op.py b/test/cinn/ops/test_logical_not_op.py index 1e04ac6eaee..d2fe5733fc8 100644 --- a/test/cinn/ops/test_logical_not_op.py +++ b/test/cinn/ops/test_logical_not_op.py @@ -12,10 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest -import cinn -import numpy as np from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool diff --git a/test/cinn/ops/test_logical_or_op.py b/test/cinn/ops/test_logical_or_op.py index 0b7344d53be..594eced153d 100644 --- a/test/cinn/ops/test_logical_or_op.py +++ b/test/cinn/ops/test_logical_or_op.py @@ -12,9 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest -import cinn import numpy as np from cinn.common import * from cinn.frontend import * diff --git a/test/cinn/ops/test_logical_right_shift_op.py b/test/cinn/ops/test_logical_right_shift_op.py index 52500698b8c..8651d505613 100644 --- a/test/cinn/ops/test_logical_right_shift_op.py +++ b/test/cinn/ops/test_logical_right_shift_op.py @@ -14,7 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import cinn import numpy as np from cinn.common import * from cinn.frontend import * diff --git a/test/cinn/ops/test_logical_xor_op.py b/test/cinn/ops/test_logical_xor_op.py index b216c6a7a7d..629a5e68e17 100644 --- a/test/cinn/ops/test_logical_xor_op.py +++ b/test/cinn/ops/test_logical_xor_op.py @@ -12,9 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest -import cinn import numpy as np from cinn.common import * from cinn.frontend import * diff --git a/test/cinn/ops/test_lookup_table_op.py b/test/cinn/ops/test_lookup_table_op.py index 21eec9de763..e1516e82358 100644 --- a/test/cinn/ops/test_lookup_table_op.py +++ b/test/cinn/ops/test_lookup_table_op.py @@ -14,7 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import cinn from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool diff --git a/test/cinn/ops/test_matmul_op.py b/test/cinn/ops/test_matmul_op.py index a2fd1523266..f47e96e0278 100755 --- a/test/cinn/ops/test_matmul_op.py +++ b/test/cinn/ops/test_matmul_op.py @@ -14,17 +14,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest -import cinn -import numpy as np from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool from op_test_helper import TestCaseHelper import paddle -import paddle.nn.functional as F @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_mod_op.py b/test/cinn/ops/test_mod_op.py index b93e9481a3d..8a409b8fec6 100644 --- a/test/cinn/ops/test_mod_op.py +++ b/test/cinn/ops/test_mod_op.py @@ -14,10 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest -import cinn -import numpy as np from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool diff --git a/test/cinn/ops/test_negative_op.py b/test/cinn/ops/test_negative_op.py index f8d8b7ecd29..d2de2967914 100644 --- a/test/cinn/ops/test_negative_op.py +++ b/test/cinn/ops/test_negative_op.py @@ -14,8 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import cinn -import numpy as np from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool diff --git a/test/cinn/ops/test_one_hot_op.py b/test/cinn/ops/test_one_hot_op.py index 02d5f4502e1..e76cee6e01d 100755 --- a/test/cinn/ops/test_one_hot_op.py +++ b/test/cinn/ops/test_one_hot_op.py @@ -14,10 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest -import cinn -import numpy as np from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool diff --git a/test/cinn/ops/test_pow_op.py b/test/cinn/ops/test_pow_op.py index c02afc72676..4728fc95b96 100644 --- a/test/cinn/ops/test_pow_op.py +++ b/test/cinn/ops/test_pow_op.py @@ -14,7 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import cinn import numpy as np from cinn.common import * from cinn.frontend import * diff --git a/test/cinn/ops/test_randint_op.py b/test/cinn/ops/test_randint_op.py index 4a88a8e50fe..b2102357d84 100644 --- a/test/cinn/ops/test_randint_op.py +++ b/test/cinn/ops/test_randint_op.py @@ -15,10 +15,7 @@ # limitations under the License. import unittest -from random import seed -import cinn -import numpy as np from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool diff --git a/test/cinn/ops/test_reciprocal_op.py b/test/cinn/ops/test_reciprocal_op.py index 45679b4ec4e..8a8eaf2276d 100644 --- a/test/cinn/ops/test_reciprocal_op.py +++ b/test/cinn/ops/test_reciprocal_op.py @@ -12,13 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest -import cinn import numpy as np from cinn.common import * from cinn.frontend import * -from op_test import OpTest, OpTestTool +from op_test import OpTest from op_test_helper import TestCaseHelper import paddle diff --git a/test/cinn/ops/test_reduce_op.py b/test/cinn/ops/test_reduce_op.py index fca5d316050..238dcbf1a54 100644 --- a/test/cinn/ops/test_reduce_op.py +++ b/test/cinn/ops/test_reduce_op.py @@ -16,7 +16,6 @@ import unittest -import cinn import numpy as np from cinn.common import * from cinn.frontend import * diff --git a/test/cinn/ops/test_reduce_op_new.py b/test/cinn/ops/test_reduce_op_new.py index 105a56c5bc5..cb295ccff41 100644 --- a/test/cinn/ops/test_reduce_op_new.py +++ b/test/cinn/ops/test_reduce_op_new.py @@ -12,10 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest -import cinn -import numpy as np from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool diff --git a/test/cinn/ops/test_relu6_op.py b/test/cinn/ops/test_relu6_op.py index bb9faad7770..41369dd1554 100644 --- a/test/cinn/ops/test_relu6_op.py +++ b/test/cinn/ops/test_relu6_op.py @@ -12,10 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest -import cinn -import numpy as np from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool diff --git a/test/cinn/ops/test_remainder_op.py b/test/cinn/ops/test_remainder_op.py index dbbbca33b27..597c5bbcf6b 100644 --- a/test/cinn/ops/test_remainder_op.py +++ b/test/cinn/ops/test_remainder_op.py @@ -14,7 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import cinn import numpy as np from cinn.common import * from cinn.frontend import * diff --git a/test/cinn/ops/test_resize_op.py b/test/cinn/ops/test_resize_op.py index dd3ab475d04..9c6118cdb47 100644 --- a/test/cinn/ops/test_resize_op.py +++ b/test/cinn/ops/test_resize_op.py @@ -14,16 +14,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest -import cinn -import numpy as np from cinn.common import * from cinn.frontend import * -from op_test import OpTest, OpTestTool - -import paddle -from paddle.vision.transforms import functional as F # paddle resize is based on cv2 module # This test requires cv2 module (pip3.6 install opencv_python==3.2.0.7) diff --git a/test/cinn/ops/test_right_shift_op.py b/test/cinn/ops/test_right_shift_op.py index e4ac9a2fb40..400d82110d1 100644 --- a/test/cinn/ops/test_right_shift_op.py +++ b/test/cinn/ops/test_right_shift_op.py @@ -12,9 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest -import cinn import numpy as np from cinn.common import * from cinn.frontend import * diff --git a/test/cinn/ops/test_round_op.py b/test/cinn/ops/test_round_op.py index 0da35d93d4d..dab3ef16775 100644 --- a/test/cinn/ops/test_round_op.py +++ b/test/cinn/ops/test_round_op.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import cinn from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool diff --git a/test/cinn/ops/test_rsqrt_op.py b/test/cinn/ops/test_rsqrt_op.py index 8c1c13937eb..c48ebc92aa8 100644 --- a/test/cinn/ops/test_rsqrt_op.py +++ b/test/cinn/ops/test_rsqrt_op.py @@ -14,8 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import cinn -import numpy as np from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool diff --git a/test/cinn/ops/test_scale_op.py b/test/cinn/ops/test_scale_op.py index 35f101cd6e1..577093dbaf5 100644 --- a/test/cinn/ops/test_scale_op.py +++ b/test/cinn/ops/test_scale_op.py @@ -12,10 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest -import cinn -import numpy as np from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool diff --git a/test/cinn/ops/test_sin_op.py b/test/cinn/ops/test_sin_op.py index adb0385cda0..93b60714682 100644 --- a/test/cinn/ops/test_sin_op.py +++ b/test/cinn/ops/test_sin_op.py @@ -14,8 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import cinn -import numpy as np from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool diff --git a/test/cinn/ops/test_sinh_op.py b/test/cinn/ops/test_sinh_op.py index 66e2675d7fe..84ad57dd8d0 100644 --- a/test/cinn/ops/test_sinh_op.py +++ b/test/cinn/ops/test_sinh_op.py @@ -14,8 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import cinn -import numpy as np from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool diff --git a/test/cinn/ops/test_sqrt_op.py b/test/cinn/ops/test_sqrt_op.py index 670034602e1..2af490581e6 100644 --- a/test/cinn/ops/test_sqrt_op.py +++ b/test/cinn/ops/test_sqrt_op.py @@ -14,8 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import cinn -import numpy as np from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool diff --git a/test/cinn/ops/test_tan_op.py b/test/cinn/ops/test_tan_op.py index 3e26841d618..bd43fa6ad42 100644 --- a/test/cinn/ops/test_tan_op.py +++ b/test/cinn/ops/test_tan_op.py @@ -14,8 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import cinn -import numpy as np from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool diff --git a/test/cinn/ops/test_tanh_op.py b/test/cinn/ops/test_tanh_op.py index 8af25cfb4f6..15c806f89e1 100644 --- a/test/cinn/ops/test_tanh_op.py +++ b/test/cinn/ops/test_tanh_op.py @@ -14,8 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import cinn -import numpy as np from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool diff --git a/test/cinn/ops/test_trunc_op.py b/test/cinn/ops/test_trunc_op.py index 9e3d95d84d4..64df64d2199 100644 --- a/test/cinn/ops/test_trunc_op.py +++ b/test/cinn/ops/test_trunc_op.py @@ -14,8 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import cinn -import numpy as np from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool diff --git a/test/cinn/ops/test_unary_elementwise_op.py b/test/cinn/ops/test_unary_elementwise_op.py index 40cda2d1def..f9207bcb307 100644 --- a/test/cinn/ops/test_unary_elementwise_op.py +++ b/test/cinn/ops/test_unary_elementwise_op.py @@ -16,7 +16,6 @@ import unittest -import cinn import numpy as np from cinn.common import * from cinn.frontend import * diff --git a/test/cinn/ops/test_uniform_random_op.py b/test/cinn/ops/test_uniform_random_op.py index 52245e3a358..0cfc2de497b 100644 --- a/test/cinn/ops/test_uniform_random_op.py +++ b/test/cinn/ops/test_uniform_random_op.py @@ -14,7 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import cinn from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool diff --git a/test/cinn/ops/test_zero_dim_tensor.py b/test/cinn/ops/test_zero_dim_tensor.py index 28d8cd94aaa..152dc0c741f 100644 --- a/test/cinn/ops/test_zero_dim_tensor.py +++ b/test/cinn/ops/test_zero_dim_tensor.py @@ -16,7 +16,6 @@ import unittest -import cinn import numpy as np from cinn.common import * from cinn.frontend import * diff --git a/test/cinn/passes/pass_test.py b/test/cinn/passes/pass_test.py index 1f047f2348b..099d5b2a07f 100644 --- a/test/cinn/passes/pass_test.py +++ b/test/cinn/passes/pass_test.py @@ -16,12 +16,7 @@ import logging import os from test.cinn.ops.op_test import OpTest -from cinn.frontend import ( - NetBuilder, - Variable, - get_default_graph_pass, - get_default_program_pass, -) +from cinn.frontend import NetBuilder, Variable logging.basicConfig(level=os.environ.get('LOG_LEVEL', 'INFO').upper()) logger = logging.getLogger(name="pass_test") diff --git a/test/cinn/test_common.py b/test/cinn/test_common.py index 61caba97f55..415cab8b64a 100644 --- a/test/cinn/test_common.py +++ b/test/cinn/test_common.py @@ -16,8 +16,6 @@ import unittest -import cinn -from cinn import Target, ir, lang, runtime from cinn.common import * diff --git a/test/cinn/test_computation.py b/test/cinn/test_computation.py index 7081749021c..e09074810fd 100755 --- a/test/cinn/test_computation.py +++ b/test/cinn/test_computation.py @@ -17,9 +17,7 @@ import sys import unittest -import cinn import numpy as np -from cinn import Target, ir, lang, runtime from cinn.common import * from cinn.framework import * from cinn.frontend import * diff --git a/test/cinn/test_efficientnet.py b/test/cinn/test_efficientnet.py index 0b277ef760b..7df10747a69 100755 --- a/test/cinn/test_efficientnet.py +++ b/test/cinn/test_efficientnet.py @@ -18,14 +18,11 @@ import sys import time import unittest -import cinn import numpy as np -from cinn import Target, ir, lang, runtime from cinn.common import * from cinn.framework import * from cinn.frontend import * -import paddle from paddle import fluid enable_gpu = sys.argv.pop() diff --git a/test/cinn/test_facedet.py b/test/cinn/test_facedet.py index 31b7e18c5e2..88e98cc4fb0 100755 --- a/test/cinn/test_facedet.py +++ b/test/cinn/test_facedet.py @@ -18,14 +18,11 @@ import sys import time import unittest -import cinn import numpy as np -from cinn import Target, ir, lang, runtime from cinn.common import * from cinn.framework import * from cinn.frontend import * -import paddle from paddle import fluid enable_gpu = sys.argv.pop() diff --git a/test/cinn/test_frontend.py b/test/cinn/test_frontend.py index 52196a48abc..9b33174e8a7 100755 --- a/test/cinn/test_frontend.py +++ b/test/cinn/test_frontend.py @@ -17,14 +17,11 @@ import sys import unittest -import cinn import numpy as np -from cinn import Target, ir, lang, runtime from cinn.common import * from cinn.framework import * from cinn.frontend import * -import paddle from paddle import fluid assert len(sys.argv) == 1 + 2 + 1 # model and enable_gpu count diff --git a/test/cinn/test_ir.py b/test/cinn/test_ir.py index af14f1efbcd..d9dd02eea57 100644 --- a/test/cinn/test_ir.py +++ b/test/cinn/test_ir.py @@ -16,8 +16,6 @@ import unittest -import cinn -from cinn import Target, ir, lang, runtime from cinn.common import * from cinn.ir import * from cinn.optim import * diff --git a/test/cinn/test_mobilenetv1.py b/test/cinn/test_mobilenetv1.py index fc49d51efb9..06365105fff 100644 --- a/test/cinn/test_mobilenetv1.py +++ b/test/cinn/test_mobilenetv1.py @@ -18,14 +18,11 @@ import sys import time import unittest -import cinn import numpy as np -from cinn import Target, ir, lang, runtime from cinn.common import * from cinn.framework import * from cinn.frontend import * -import paddle from paddle import fluid enable_gpu = sys.argv.pop() diff --git a/test/cinn/test_mobilenetv2.py b/test/cinn/test_mobilenetv2.py index 045c63ee7ab..461bfdd630c 100755 --- a/test/cinn/test_mobilenetv2.py +++ b/test/cinn/test_mobilenetv2.py @@ -18,14 +18,11 @@ import sys import time import unittest -import cinn import numpy as np -from cinn import Target, ir, lang, runtime from cinn.common import * from cinn.framework import * from cinn.frontend import * -import paddle from paddle import fluid enable_gpu = sys.argv.pop() diff --git a/test/cinn/test_netbuilder.py b/test/cinn/test_netbuilder.py index 3da2de3c6b3..3e6a3081ed6 100755 --- a/test/cinn/test_netbuilder.py +++ b/test/cinn/test_netbuilder.py @@ -17,9 +17,7 @@ import sys import unittest -import cinn import numpy as np -from cinn import Target, ir, lang, runtime from cinn.common import * from cinn.framework import * from cinn.frontend import * diff --git a/test/cinn/test_op_benchmark.py b/test/cinn/test_op_benchmark.py index 7ab0806d87e..1240b513481 100755 --- a/test/cinn/test_op_benchmark.py +++ b/test/cinn/test_op_benchmark.py @@ -17,9 +17,7 @@ import sys import unittest -import cinn import numpy as np -from cinn import Target, ir, lang, runtime from cinn.common import * from cinn.framework import * from cinn.frontend import * @@ -314,7 +312,7 @@ __global__ void fn_conv2d_0_kernel(float* __restrict__ placeholder, float* __res "TESTING [mul and add] time cost with shape [128,512]*[256,512]...", ) - def atest_matmul(self): + def atest_matmul3(self): prog = Program() a = Variable("A").set_type(Float(32)).set_shape([512, 512]) b = Variable("B").set_type(Float(32)).set_shape([512, 512]) @@ -440,7 +438,7 @@ typedef char int8_t; (tensor_data[0] + tensor_data[1]).reshape(-1), result, atol=1e-4 ) - def atest_elementwise2(self): + def atest_elementwise3(self): prog = Program() a = Variable("A").set_type(Float(32)).set_shape([4, 1024]) b = Variable("B").set_type(Float(32)).set_shape([4, 1024]) diff --git a/test/cinn/test_op_broadcast.py b/test/cinn/test_op_broadcast.py index 26e8ab67bc7..4aa2f9fb430 100644 --- a/test/cinn/test_op_broadcast.py +++ b/test/cinn/test_op_broadcast.py @@ -14,14 +14,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -import logging -import math import unittest -import cinn -import numpy as np -from cinn import common, framework, frontend, ir, lang, runtime -from cinn.poly import create_stages +from cinn import framework from test_utils import SingleOpTester diff --git a/test/cinn/test_op_nn.py b/test/cinn/test_op_nn.py index 9535e16b647..ed862cecfcd 100644 --- a/test/cinn/test_op_nn.py +++ b/test/cinn/test_op_nn.py @@ -14,20 +14,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -import logging import math import unittest -import cinn import conv2d_utils import numpy as np import pool_utils -from cinn import common, framework, frontend, ir, lang, runtime -from cinn.poly import create_stages +from cinn import framework from test_utils import SingleOpTester -import paddle - class OpTest_relu(SingleOpTester): def create_target_data(self, inputs_data, attrs): diff --git a/test/cinn/test_op_transform.py b/test/cinn/test_op_transform.py index 2f4958a22bb..7da12d59e7b 100644 --- a/test/cinn/test_op_transform.py +++ b/test/cinn/test_op_transform.py @@ -14,15 +14,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import logging -import math import os import unittest -import cinn -import numpy as np -from cinn import common, framework, frontend, ir, lang, runtime -from cinn.poly import create_stages +from cinn import framework from test_utils import SingleOpTester import paddle diff --git a/test/cinn/test_packed_func.py b/test/cinn/test_packed_func.py index 4525eab37ec..3a833df11fd 100755 --- a/test/cinn/test_packed_func.py +++ b/test/cinn/test_packed_func.py @@ -18,8 +18,7 @@ import unittest from math import isclose import cinn -import numpy as np -from cinn import CINNValue, ir +from cinn import ir class TestPackedFunc(unittest.TestCase): diff --git a/test/cinn/test_paddle_model_convertor.py b/test/cinn/test_paddle_model_convertor.py index b0c0c55ae11..af80736f466 100644 --- a/test/cinn/test_paddle_model_convertor.py +++ b/test/cinn/test_paddle_model_convertor.py @@ -21,15 +21,10 @@ import sys import unittest import numpy as np -from cinn.common import ( - DefaultHostTarget, - DefaultNVGPUTarget, - is_compiled_with_cuda, -) +from cinn.common import DefaultHostTarget, DefaultNVGPUTarget from cinn.frontend import PaddleModelConvertor from cinn.runtime import seed as cinn_seed from op_mappers.op_mapper_test import OpMapperTest -from ops.op_test import OpTestTool import paddle diff --git a/test/cinn/test_pe_elementwise.py b/test/cinn/test_pe_elementwise.py index 2f17231d31f..aed47499c0f 100644 --- a/test/cinn/test_pe_elementwise.py +++ b/test/cinn/test_pe_elementwise.py @@ -22,7 +22,6 @@ import scipy from cinn import Target, ir, lang, pe, runtime from cinn.common import * from cinn.poly import create_stages -from scipy import special class TestPEElementwise(unittest.TestCase): diff --git a/test/cinn/test_resnet.py b/test/cinn/test_resnet.py index 556436cae33..03ff2a8c4aa 100755 --- a/test/cinn/test_resnet.py +++ b/test/cinn/test_resnet.py @@ -17,14 +17,11 @@ import sys import unittest -import cinn import numpy as np -from cinn import Target, ir, lang, runtime from cinn.common import * from cinn.framework import * from cinn.frontend import * -import paddle from paddle import fluid enable_gpu = sys.argv.pop() diff --git a/test/cinn/test_resnet18.py b/test/cinn/test_resnet18.py index 453aece0159..6eb59359402 100755 --- a/test/cinn/test_resnet18.py +++ b/test/cinn/test_resnet18.py @@ -18,14 +18,11 @@ import sys import time import unittest -import cinn import numpy as np -from cinn import Target, ir, lang, runtime from cinn.common import * from cinn.framework import * from cinn.frontend import * -import paddle from paddle import fluid enable_gpu = sys.argv.pop() diff --git a/test/cinn/test_resnet50.py b/test/cinn/test_resnet50.py index 1046f85984e..fc39e310dae 100755 --- a/test/cinn/test_resnet50.py +++ b/test/cinn/test_resnet50.py @@ -18,14 +18,11 @@ import sys import time import unittest -import cinn import numpy as np -from cinn import Target, ir, lang, runtime from cinn.common import * from cinn.framework import * from cinn.frontend import * -import paddle from paddle import fluid enable_gpu = sys.argv.pop() diff --git a/test/cinn/test_squeezenet.py b/test/cinn/test_squeezenet.py index b85a72d2e12..fde7ae12a87 100644 --- a/test/cinn/test_squeezenet.py +++ b/test/cinn/test_squeezenet.py @@ -18,14 +18,11 @@ import sys import time import unittest -import cinn import numpy as np -from cinn import Target, ir, lang, runtime from cinn.common import * from cinn.framework import * from cinn.frontend import * -import paddle from paddle import fluid enable_gpu = sys.argv.pop() diff --git a/test/cinn/test_utils.py b/test/cinn/test_utils.py index e1a999d40df..5bec1964862 100755 --- a/test/cinn/test_utils.py +++ b/test/cinn/test_utils.py @@ -15,13 +15,11 @@ # limitations under the License. import logging -import math import unittest import cinn import numpy as np -from cinn import common, framework, frontend, ir, lang, runtime -from cinn.poly import create_stages +from cinn import common, framework, ir, lang, runtime class SingleOpTester(unittest.TestCase): -- GitLab