From 6a8847f36d0befd6c8172b10b4bae28103b50a64 Mon Sep 17 00:00:00 2001 From: zhangjingwei <57820731+Ainavo@users.noreply.github.com> Date: Fri, 30 Jun 2023 10:29:07 +0800 Subject: [PATCH] [CodeStyle][CINN] format import region in python code via isort (#54963) Co-authored-by: SigureMo --- .../backends/llvm/generate_runtime_llvm_ir.py | 2 +- pyproject.toml | 3 --- python/cinn/backends.py | 3 +-- python/cinn/common.py | 17 ++++++++++----- python/cinn/lang.py | 4 +--- python/cinn/optim.py | 3 +-- .../cost_model/test_cost_model.py | 5 ++--- test/cinn/conv2d_utils.py | 3 ++- test/cinn/fake_model/naive_mul.py | 5 ++++- test/cinn/fake_model/naive_multi_fc.py | 5 ++++- test/cinn/fake_model/resnet_model.py | 7 +++++-- .../fusion/test_cast_broadcast_reduce_max.py | 1 + test/cinn/fusion/test_reduce_cast.py | 1 + test/cinn/fusion/test_select_reduce.py | 1 + test/cinn/op_mappers/op_mapper_test.py | 15 +++++++------ test/cinn/op_mappers/test_argmax_op.py | 8 ++++--- test/cinn/op_mappers/test_argmin_op.py | 8 ++++--- test/cinn/op_mappers/test_argsort_op.py | 2 ++ test/cinn/op_mappers/test_assign_value_op.py | 2 ++ test/cinn/op_mappers/test_atan2_op.py | 2 ++ test/cinn/op_mappers/test_batch_norm_op.py | 2 ++ test/cinn/op_mappers/test_bitwise_op.py | 2 ++ test/cinn/op_mappers/test_cholesky_op.py | 4 +++- test/cinn/op_mappers/test_clip_op.py | 4 +++- test/cinn/op_mappers/test_compare_op.py | 2 ++ test/cinn/op_mappers/test_conv2d_op.py | 2 ++ test/cinn/op_mappers/test_cumsum_op.py | 2 ++ test/cinn/op_mappers/test_elementwise_op.py | 2 ++ test/cinn/op_mappers/test_expand_op.py | 2 ++ test/cinn/op_mappers/test_expand_v2_op.py | 2 ++ test/cinn/op_mappers/test_fill_constant_op.py | 2 ++ test/cinn/op_mappers/test_flip_op.py | 2 ++ test/cinn/op_mappers/test_gather_nd_op.py | 2 ++ test/cinn/op_mappers/test_gather_op.py | 2 ++ .../op_mappers/test_gaussian_random_op.py | 2 ++ test/cinn/op_mappers/test_layer_norm_op.py | 4 +++- test/cinn/op_mappers/test_log1p_op.py | 2 ++ test/cinn/op_mappers/test_logical_op.py | 2 ++ test/cinn/op_mappers/test_lookup_table_op.py | 2 ++ test/cinn/op_mappers/test_mul_op.py | 2 ++ test/cinn/op_mappers/test_norm_op.py | 2 ++ test/cinn/op_mappers/test_one_hot_op.py | 2 ++ test/cinn/op_mappers/test_pool2d_op.py | 6 ++++-- test/cinn/op_mappers/test_pow_op.py | 2 ++ test/cinn/op_mappers/test_randint_op.py | 2 ++ test/cinn/op_mappers/test_reduce_op.py | 2 ++ test/cinn/op_mappers/test_reverse_op.py | 2 ++ test/cinn/op_mappers/test_roll_op.py | 2 ++ test/cinn/op_mappers/test_scale_op.py | 2 ++ test/cinn/op_mappers/test_scatter_op.py | 6 ++++-- test/cinn/op_mappers/test_sign_op.py | 2 ++ test/cinn/op_mappers/test_split_op.py | 2 ++ test/cinn/op_mappers/test_squeeze_op.py | 2 ++ test/cinn/op_mappers/test_stack_op.py | 2 ++ test/cinn/op_mappers/test_strided_slice_op.py | 2 ++ .../op_mappers/test_take_along_axis_op.py | 2 ++ test/cinn/op_mappers/test_tile_op.py | 2 ++ test/cinn/op_mappers/test_transpose2_op.py | 2 ++ .../op_mappers/test_triangular_solve_op.py | 2 ++ test/cinn/op_mappers/test_unary_op.py | 2 ++ .../cinn/op_mappers/test_uniform_random_op.py | 2 ++ test/cinn/op_mappers/test_where_op.py | 2 ++ test/cinn/ops/op_test.py | 15 ++++++------- test/cinn/ops/op_test_helper.py | 7 +++---- test/cinn/ops/test_abs_op.py | 6 ++++-- test/cinn/ops/test_acos_op.py | 8 ++++--- test/cinn/ops/test_acosh_op.py | 8 ++++--- test/cinn/ops/test_add_op.py | 3 ++- test/cinn/ops/test_arange_op.py | 5 +++-- test/cinn/ops/test_argsort_op.py | 8 ++++--- test/cinn/ops/test_asin_op.py | 7 ++++--- test/cinn/ops/test_asinh_op.py | 8 ++++--- test/cinn/ops/test_atan2_op.py | 5 +++-- test/cinn/ops/test_atan_op.py | 8 ++++--- test/cinn/ops/test_atanh_op.py | 8 ++++--- test/cinn/ops/test_batch_norm_op.py | 11 ++++++---- test/cinn/ops/test_binary_elementwise_op.py | 8 ++++--- test/cinn/ops/test_bitcast_convert_op.py | 11 +++++----- test/cinn/ops/test_bitwise_op.py | 5 +++-- test/cinn/ops/test_broadcast_to_op.py | 10 +++++---- test/cinn/ops/test_broadcast_to_op_new.py | 5 +++-- test/cinn/ops/test_cast_op.py | 8 ++++--- test/cinn/ops/test_cbrt_op.py | 3 ++- test/cinn/ops/test_ceil_op.py | 3 ++- test/cinn/ops/test_cholesky_op.py | 3 ++- test/cinn/ops/test_clz_op.py | 3 ++- test/cinn/ops/test_comparison_op.py | 5 +++-- test/cinn/ops/test_concat_op.py | 3 ++- test/cinn/ops/test_constant_op.py | 3 ++- test/cinn/ops/test_conv2d_op.py | 9 ++++---- test/cinn/ops/test_cos_op.py | 7 ++++--- test/cinn/ops/test_cosh_op.py | 7 ++++--- test/cinn/ops/test_depthwise_conv2d_op.py | 7 ++++--- test/cinn/ops/test_divide_op.py | 5 +++-- test/cinn/ops/test_dropout_infer_op.py | 8 ++++--- test/cinn/ops/test_erf_op.py | 7 ++++--- test/cinn/ops/test_exp_op.py | 7 ++++--- test/cinn/ops/test_expand_dims.py | 5 +++-- test/cinn/ops/test_fill_constant_op.py | 3 ++- test/cinn/ops/test_floor_divide_op.py | 8 ++++--- test/cinn/ops/test_floor_op.py | 7 ++++--- test/cinn/ops/test_gather_nd_op.py | 14 +++++++------ test/cinn/ops/test_gather_op.py | 14 +++++++------ test/cinn/ops/test_gaussian_random_op.py | 7 ++++--- test/cinn/ops/test_gelu_op.py | 8 ++++--- test/cinn/ops/test_identity_op.py | 6 ++++-- test/cinn/ops/test_is_finite_op.py | 8 ++++--- test/cinn/ops/test_is_inf_op.py | 8 ++++--- test/cinn/ops/test_is_nan_op.py | 8 ++++--- test/cinn/ops/test_isclose_op.py | 7 ++++--- test/cinn/ops/test_left_shift_op.py | 8 ++++--- test/cinn/ops/test_log_op.py | 7 ++++--- test/cinn/ops/test_logical_and_op.py | 8 ++++--- test/cinn/ops/test_logical_not_op.py | 8 ++++--- test/cinn/ops/test_logical_or_op.py | 8 ++++--- test/cinn/ops/test_logical_right_shift_op.py | 7 ++++--- test/cinn/ops/test_logical_xor_op.py | 8 ++++--- test/cinn/ops/test_lookup_table_op.py | 7 ++++--- test/cinn/ops/test_matmul_op.py | 8 ++++--- test/cinn/ops/test_max_op.py | 5 +++-- test/cinn/ops/test_min_op.py | 5 +++-- test/cinn/ops/test_mod_op.py | 8 ++++--- test/cinn/ops/test_mul_op.py | 10 +++++---- test/cinn/ops/test_multiply_op.py | 5 +++-- test/cinn/ops/test_negative_op.py | 7 ++++--- test/cinn/ops/test_one_hot_op.py | 8 ++++--- test/cinn/ops/test_pool2d_op.py | 5 +++-- test/cinn/ops/test_popc_op.py | 3 ++- test/cinn/ops/test_pow_op.py | 7 ++++--- test/cinn/ops/test_randint_op.py | 10 +++++---- test/cinn/ops/test_reciprocal_op.py | 8 ++++--- test/cinn/ops/test_reduce_op.py | 8 ++++--- test/cinn/ops/test_reduce_op_new.py | 8 ++++--- test/cinn/ops/test_relu6_op.py | 8 ++++--- test/cinn/ops/test_relu_op.py | 7 ++++--- test/cinn/ops/test_remainder_op.py | 7 ++++--- test/cinn/ops/test_repeat_op.py | 5 +++-- test/cinn/ops/test_reshape_op.py | 5 +++-- test/cinn/ops/test_resize_op.py | 8 ++++--- test/cinn/ops/test_reverse_op.py | 3 ++- test/cinn/ops/test_right_shift_op.py | 8 ++++--- test/cinn/ops/test_round_op.py | 7 ++++--- test/cinn/ops/test_rsqrt_op.py | 7 ++++--- test/cinn/ops/test_scale_op.py | 8 ++++--- test/cinn/ops/test_scatter_add.py | 5 +++-- test/cinn/ops/test_scatter_assign_op.py | 5 +++-- test/cinn/ops/test_select_op.py | 5 +++-- test/cinn/ops/test_sigmoid_op.py | 7 ++++--- test/cinn/ops/test_sign_op.py | 5 +++-- test/cinn/ops/test_sin_op.py | 7 ++++--- test/cinn/ops/test_sinh_op.py | 7 ++++--- test/cinn/ops/test_slice_assign_op.py | 5 +++-- test/cinn/ops/test_slice_op.py | 5 +++-- test/cinn/ops/test_softmax_op.py | 7 ++++--- test/cinn/ops/test_sort_op.py | 5 +++-- test/cinn/ops/test_split_op.py | 5 +++-- test/cinn/ops/test_sqrt_op.py | 7 ++++--- test/cinn/ops/test_squeeze_op.py | 5 +++-- test/cinn/ops/test_subtract_op.py | 5 +++-- test/cinn/ops/test_sum_op.py | 5 +++-- test/cinn/ops/test_tan_op.py | 7 ++++--- test/cinn/ops/test_tanh_op.py | 7 ++++--- test/cinn/ops/test_top_k_op.py | 5 +++-- test/cinn/ops/test_transpose_op.py | 5 +++-- test/cinn/ops/test_triangular_solve_op.py | 5 +++-- test/cinn/ops/test_trunc_op.py | 7 ++++--- test/cinn/ops/test_unary_elementwise_op.py | 8 ++++--- test/cinn/ops/test_uniform_random_op.py | 7 ++++--- test/cinn/ops/test_zero_dim_tensor.py | 8 ++++--- test/cinn/passes/pass_test.py | 9 ++++++-- test/cinn/passes/test_auto_cast_pass.py | 5 +++-- test/cinn/passes/test_expand_zero_dim_pass.py | 7 ++++--- .../test_transpose_floding_input_pass.py | 5 +++-- .../test_transpose_floding_output_pass.py | 5 +++-- test/cinn/pool_utils.py | 3 ++- test/cinn/test_common.py | 6 ++---- test/cinn/test_computation.py | 21 +++++++++---------- test/cinn/test_efficientnet.py | 21 +++++++++---------- test/cinn/test_facedet.py | 21 +++++++++---------- test/cinn/test_frontend.py | 19 ++++++++--------- test/cinn/test_hlir_framework.py | 3 ++- test/cinn/test_ir.py | 8 +++---- test/cinn/test_matmul.py | 9 +++----- test/cinn/test_mobilenetv1.py | 21 +++++++++---------- test/cinn/test_mobilenetv2.py | 21 +++++++++---------- test/cinn/test_netbuilder.py | 19 ++++++++--------- test/cinn/test_op_benchmark.py | 19 ++++++++--------- test/cinn/test_op_broadcast.py | 14 +++++-------- test/cinn/test_op_nn.py | 21 ++++++++----------- test/cinn/test_op_transform.py | 17 +++++++-------- test/cinn/test_packed_func.py | 8 +++---- test/cinn/test_paddle_model_convertor.py | 16 +++++++------- test/cinn/test_pe_elementwise.py | 11 ++++------ test/cinn/test_pe_reduction.py | 7 ++----- test/cinn/test_pe_transform.py | 9 +++----- test/cinn/test_resnet.py | 19 ++++++++--------- test/cinn/test_resnet18.py | 21 +++++++++---------- test/cinn/test_resnet50.py | 21 +++++++++---------- test/cinn/test_squeezenet.py | 21 +++++++++---------- test/cinn/test_utils.py | 14 +++++-------- tools/cinn/gen_c++_tutorial.py | 2 +- .../paddle_benchmark/paddle_save_model.py | 5 ++++- .../paddle_benchmark/paddle_test_benchmark.py | 5 +++-- .../cinn/paddle_benchmark/test_paddle_ops.py | 12 ++++++----- tools/cinn/tvm_benchmark/test_topi_default.py | 12 +++++------ .../tvm_benchmark/tvm_graph_with_single_op.py | 9 +++----- 206 files changed, 805 insertions(+), 581 deletions(-) diff --git a/paddle/cinn/backends/llvm/generate_runtime_llvm_ir.py b/paddle/cinn/backends/llvm/generate_runtime_llvm_ir.py index 16f4d38980c..cb57d85c32c 100644 --- a/paddle/cinn/backends/llvm/generate_runtime_llvm_ir.py +++ b/paddle/cinn/backends/llvm/generate_runtime_llvm_ir.py @@ -14,8 +14,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import sys import subprocess +import sys def main(): diff --git a/pyproject.toml b/pyproject.toml index 2439d0a1f3e..254014988c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,9 +18,6 @@ extend_skip_glob = [ # see .flake8 for more details "python/paddle/fluid/**", "python/paddle/utils/gast/**", - # Temporarily ignore CINN files, it will fix later - "python/cinn/**", - "test/cinn/**", ] [tool.ruff] diff --git a/python/cinn/backends.py b/python/cinn/backends.py index f4a6c21aa57..481e14c6f85 100644 --- a/python/cinn/backends.py +++ b/python/cinn/backends.py @@ -12,5 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -from .core_api.backends import ExecutionOptions -from .core_api.backends import ExecutionEngine +from .core_api.backends import ExecutionEngine, ExecutionOptions diff --git a/python/cinn/common.py b/python/cinn/common.py index 97cc89e9b4a..ae089cfce2d 100644 --- a/python/cinn/common.py +++ b/python/cinn/common.py @@ -12,9 +12,16 @@ # See the License for the specific language governing permissions and # limitations under the License. -from .core_api.common import make_const -from .core_api.common import Target -from .core_api.common import Type -from .core_api.common import CINNValue -from .core_api.common import Void, Int, UInt, Float, Bool, String from .core_api.common import * +from .core_api.common import ( + Bool, + CINNValue, + Float, + Int, + String, + Target, + Type, + UInt, + Void, + make_const, +) diff --git a/python/cinn/lang.py b/python/cinn/lang.py index 18eaed8cb76..bee58107e05 100644 --- a/python/cinn/lang.py +++ b/python/cinn/lang.py @@ -12,7 +12,5 @@ # See the License for the specific language governing permissions and # limitations under the License. -from .core_api.lang import Buffer -from .core_api.lang import lower -from .core_api.lang import compute from .core_api.lang import * +from .core_api.lang import Buffer, compute, lower diff --git a/python/cinn/optim.py b/python/cinn/optim.py index 11a16b872ed..c1c77a9a6cf 100644 --- a/python/cinn/optim.py +++ b/python/cinn/optim.py @@ -12,5 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -from .core_api.optim import simplify -from .core_api.optim import ir_copy +from .core_api.optim import ir_copy, simplify 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 1a6f38bce65..76ed6e2feda 100644 --- a/test/cinn/auto_schedule/cost_model/test_cost_model.py +++ b/test/cinn/auto_schedule/cost_model/test_cost_model.py @@ -12,13 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -import cinn - import os import shutil -import numpy as np import unittest +import cinn +import numpy as np from cinn.auto_schedule.cost_model import CostModel diff --git a/test/cinn/conv2d_utils.py b/test/cinn/conv2d_utils.py index a97575d79d3..18a6cc02d0e 100644 --- a/test/cinn/conv2d_utils.py +++ b/test/cinn/conv2d_utils.py @@ -14,9 +14,10 @@ # See the License for the specific language governing permissions and # limitations under the License. +import numpy as np + import paddle import paddle.static as static -import numpy as np def conv2d_native(inputs_data, input_shape, filter_size, attrs, is_depthwise): diff --git a/test/cinn/fake_model/naive_mul.py b/test/cinn/fake_model/naive_mul.py index 639592ad2d6..0581c1cfdf9 100644 --- a/test/cinn/fake_model/naive_mul.py +++ b/test/cinn/fake_model/naive_mul.py @@ -12,9 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os +import sys + import numpy -import sys, os import numpy as np + import paddle import paddle.fluid as fluid import paddle.static as static diff --git a/test/cinn/fake_model/naive_multi_fc.py b/test/cinn/fake_model/naive_multi_fc.py index f0b265346ef..996bfcf81fa 100644 --- a/test/cinn/fake_model/naive_multi_fc.py +++ b/test/cinn/fake_model/naive_multi_fc.py @@ -14,9 +14,12 @@ """ A fake model with multiple FC layers to test CINN on a more complex model. """ +import os +import sys + import numpy -import sys, os import numpy as np + import paddle import paddle.fluid as fluid import paddle.static as static diff --git a/test/cinn/fake_model/resnet_model.py b/test/cinn/fake_model/resnet_model.py index c3d07ed0ed5..12d784f5283 100644 --- a/test/cinn/fake_model/resnet_model.py +++ b/test/cinn/fake_model/resnet_model.py @@ -12,10 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os +import sys + import numpy -import paddle -import sys, os import numpy as np + +import paddle import paddle.fluid as fluid import paddle.static as static diff --git a/test/cinn/fusion/test_cast_broadcast_reduce_max.py b/test/cinn/fusion/test_cast_broadcast_reduce_max.py index a52d82ae9c9..fa56018c244 100644 --- a/test/cinn/fusion/test_cast_broadcast_reduce_max.py +++ b/test/cinn/fusion/test_cast_broadcast_reduce_max.py @@ -13,6 +13,7 @@ # limitations under the License. import unittest + from fusion_test import FusionTest diff --git a/test/cinn/fusion/test_reduce_cast.py b/test/cinn/fusion/test_reduce_cast.py index dbb056df3b4..a5f09335bc2 100644 --- a/test/cinn/fusion/test_reduce_cast.py +++ b/test/cinn/fusion/test_reduce_cast.py @@ -13,6 +13,7 @@ # limitations under the License. import unittest + from fusion_test import FusionTest diff --git a/test/cinn/fusion/test_select_reduce.py b/test/cinn/fusion/test_select_reduce.py index defb6b65bea..2d5300681fe 100644 --- a/test/cinn/fusion/test_select_reduce.py +++ b/test/cinn/fusion/test_select_reduce.py @@ -13,6 +13,7 @@ # limitations under the License. import unittest + from fusion_test import FusionTest diff --git a/test/cinn/op_mappers/op_mapper_test.py b/test/cinn/op_mappers/op_mapper_test.py index f621fd2abcf..1b4076cd6e8 100644 --- a/test/cinn/op_mappers/op_mapper_test.py +++ b/test/cinn/op_mappers/op_mapper_test.py @@ -14,19 +14,18 @@ # See the License for the specific language governing permissions and # limitations under the License. -from ast import arg -import os import logging +import os +import sys +from ast import arg -import paddle -from paddle.static import Variable as PaddleVariable -from paddle.fluid.layer_helper import LayerHelper - -from cinn.frontend import NetBuilder, PaddleModelConvertor from cinn.common import is_compiled_with_cuda from cinn.framework import Scope +from cinn.frontend import NetBuilder, PaddleModelConvertor -import sys +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 diff --git a/test/cinn/op_mappers/test_argmax_op.py b/test/cinn/op_mappers/test_argmax_op.py index 3f464faffcc..25a228f437b 100644 --- a/test/cinn/op_mappers/test_argmax_op.py +++ b/test/cinn/op_mappers/test_argmax_op.py @@ -14,11 +14,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle import unittest -from op_mapper_test import OpMapperTest -from cinn.frontend import * + from cinn.common import * +from cinn.frontend import * +from op_mapper_test import OpMapperTest + +import paddle class TestArgmaxOp(OpMapperTest): diff --git a/test/cinn/op_mappers/test_argmin_op.py b/test/cinn/op_mappers/test_argmin_op.py index 6485e9a5fc2..cd6582cdb34 100644 --- a/test/cinn/op_mappers/test_argmin_op.py +++ b/test/cinn/op_mappers/test_argmin_op.py @@ -14,11 +14,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle import unittest -from op_mapper_test import OpMapperTest -from cinn.frontend import * + from cinn.common import * +from cinn.frontend import * +from op_mapper_test import OpMapperTest + +import paddle class TestArgminOp(OpMapperTest): diff --git a/test/cinn/op_mappers/test_argsort_op.py b/test/cinn/op_mappers/test_argsort_op.py index a8a55a5214c..d41cee91be9 100644 --- a/test/cinn/op_mappers/test_argsort_op.py +++ b/test/cinn/op_mappers/test_argsort_op.py @@ -15,8 +15,10 @@ # limitations under the License. import unittest + import numpy as np from op_mapper_test import OpMapperTest, logger + 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 029b5ea3fa6..a185cedbe55 100644 --- a/test/cinn/op_mappers/test_assign_value_op.py +++ b/test/cinn/op_mappers/test_assign_value_op.py @@ -15,8 +15,10 @@ # limitations under the License. import unittest + import numpy as np from op_mapper_test import OpMapperTest, logger + import paddle diff --git a/test/cinn/op_mappers/test_atan2_op.py b/test/cinn/op_mappers/test_atan2_op.py index a5e91e508b0..65e635c349b 100644 --- a/test/cinn/op_mappers/test_atan2_op.py +++ b/test/cinn/op_mappers/test_atan2_op.py @@ -15,8 +15,10 @@ # limitations under the License. import unittest + import numpy as np from op_mapper_test import OpMapperTest, logger + 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 93779bde72b..88490102c23 100644 --- a/test/cinn/op_mappers/test_batch_norm_op.py +++ b/test/cinn/op_mappers/test_batch_norm_op.py @@ -15,8 +15,10 @@ # limitations under the License. import unittest + import numpy as np from op_mapper_test import OpMapperTest, logger + import paddle diff --git a/test/cinn/op_mappers/test_bitwise_op.py b/test/cinn/op_mappers/test_bitwise_op.py index 48e72c6f6d5..309fcf9a629 100644 --- a/test/cinn/op_mappers/test_bitwise_op.py +++ b/test/cinn/op_mappers/test_bitwise_op.py @@ -15,8 +15,10 @@ # limitations under the License. import unittest + import numpy as np from op_mapper_test import OpMapperTest, logger + import paddle diff --git a/test/cinn/op_mappers/test_cholesky_op.py b/test/cinn/op_mappers/test_cholesky_op.py index 4f5bef90754..b9871b3090d 100644 --- a/test/cinn/op_mappers/test_cholesky_op.py +++ b/test/cinn/op_mappers/test_cholesky_op.py @@ -13,8 +13,10 @@ # limitations under the License. import unittest -from op_mapper_test import OpMapperTest + import numpy as np +from op_mapper_test import OpMapperTest + import paddle diff --git a/test/cinn/op_mappers/test_clip_op.py b/test/cinn/op_mappers/test_clip_op.py index b0ab1a053db..9ab4417bae7 100644 --- a/test/cinn/op_mappers/test_clip_op.py +++ b/test/cinn/op_mappers/test_clip_op.py @@ -14,11 +14,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle import random import unittest + from op_mapper_test import OpMapperTest +import paddle + class TestClipOp(OpMapperTest): def init_input_data(self): diff --git a/test/cinn/op_mappers/test_compare_op.py b/test/cinn/op_mappers/test_compare_op.py index 9d5b2b71fc0..5a30a5e9a57 100644 --- a/test/cinn/op_mappers/test_compare_op.py +++ b/test/cinn/op_mappers/test_compare_op.py @@ -15,8 +15,10 @@ # limitations under the License. import unittest + import numpy as np from op_mapper_test import OpMapperTest, logger + import paddle diff --git a/test/cinn/op_mappers/test_conv2d_op.py b/test/cinn/op_mappers/test_conv2d_op.py index c283a49b62d..15466b8160e 100644 --- a/test/cinn/op_mappers/test_conv2d_op.py +++ b/test/cinn/op_mappers/test_conv2d_op.py @@ -15,8 +15,10 @@ # limitations under the License. import unittest + import numpy as np from op_mapper_test import OpMapperTest, logger + import paddle diff --git a/test/cinn/op_mappers/test_cumsum_op.py b/test/cinn/op_mappers/test_cumsum_op.py index 2333dd5ae90..ec817f86f2a 100644 --- a/test/cinn/op_mappers/test_cumsum_op.py +++ b/test/cinn/op_mappers/test_cumsum_op.py @@ -15,8 +15,10 @@ # limitations under the License. import unittest + import numpy as np from op_mapper_test import OpMapperTest, logger + import paddle diff --git a/test/cinn/op_mappers/test_elementwise_op.py b/test/cinn/op_mappers/test_elementwise_op.py index 133d952d609..b021dbcce8c 100644 --- a/test/cinn/op_mappers/test_elementwise_op.py +++ b/test/cinn/op_mappers/test_elementwise_op.py @@ -15,8 +15,10 @@ # limitations under the License. import unittest + import numpy as np from op_mapper_test import OpMapperTest, logger + import paddle diff --git a/test/cinn/op_mappers/test_expand_op.py b/test/cinn/op_mappers/test_expand_op.py index 24d45f6a21a..59f917fcb75 100644 --- a/test/cinn/op_mappers/test_expand_op.py +++ b/test/cinn/op_mappers/test_expand_op.py @@ -15,8 +15,10 @@ # limitations under the License. import unittest + import numpy as np from op_mapper_test import OpMapperTest, logger + 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 b13f2d5d197..d82cb80a308 100644 --- a/test/cinn/op_mappers/test_expand_v2_op.py +++ b/test/cinn/op_mappers/test_expand_v2_op.py @@ -15,8 +15,10 @@ # limitations under the License. import unittest + import numpy as np from op_mapper_test import OpMapperTest, logger + 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 ed24f7f9701..5fbcb73de0a 100644 --- a/test/cinn/op_mappers/test_fill_constant_op.py +++ b/test/cinn/op_mappers/test_fill_constant_op.py @@ -15,8 +15,10 @@ # limitations under the License. import unittest + import numpy as np from op_mapper_test import OpMapperTest, logger + import paddle diff --git a/test/cinn/op_mappers/test_flip_op.py b/test/cinn/op_mappers/test_flip_op.py index 46e83936656..93cbc3d4180 100644 --- a/test/cinn/op_mappers/test_flip_op.py +++ b/test/cinn/op_mappers/test_flip_op.py @@ -15,7 +15,9 @@ # limitations under the License. import unittest + 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 7cdb389e48a..ee3458cd89d 100644 --- a/test/cinn/op_mappers/test_gather_nd_op.py +++ b/test/cinn/op_mappers/test_gather_nd_op.py @@ -15,8 +15,10 @@ # limitations under the License. import unittest + import numpy as np from op_mapper_test import OpMapperTest, logger + import paddle diff --git a/test/cinn/op_mappers/test_gather_op.py b/test/cinn/op_mappers/test_gather_op.py index 8eb55eb15ab..631d155b07e 100644 --- a/test/cinn/op_mappers/test_gather_op.py +++ b/test/cinn/op_mappers/test_gather_op.py @@ -15,8 +15,10 @@ # limitations under the License. import unittest + import numpy as np from op_mapper_test import OpMapperTest, logger + 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 1fc0fbbcee6..283a74cc550 100644 --- a/test/cinn/op_mappers/test_gaussian_random_op.py +++ b/test/cinn/op_mappers/test_gaussian_random_op.py @@ -15,8 +15,10 @@ # limitations under the License. import unittest + import numpy as np from op_mapper_test import OpMapperTest, logger + import paddle diff --git a/test/cinn/op_mappers/test_layer_norm_op.py b/test/cinn/op_mappers/test_layer_norm_op.py index d756114eead..98f8549da81 100644 --- a/test/cinn/op_mappers/test_layer_norm_op.py +++ b/test/cinn/op_mappers/test_layer_norm_op.py @@ -14,11 +14,13 @@ # 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 + import paddle -import functools class TestLayerNormOp(OpMapperTest): diff --git a/test/cinn/op_mappers/test_log1p_op.py b/test/cinn/op_mappers/test_log1p_op.py index 2002719150d..9ed8a830b19 100644 --- a/test/cinn/op_mappers/test_log1p_op.py +++ b/test/cinn/op_mappers/test_log1p_op.py @@ -15,8 +15,10 @@ # limitations under the License. import unittest + import numpy as np from op_mapper_test import OpMapperTest, logger + import paddle diff --git a/test/cinn/op_mappers/test_logical_op.py b/test/cinn/op_mappers/test_logical_op.py index 83fbaf8c5fd..9b0f95b4d3c 100644 --- a/test/cinn/op_mappers/test_logical_op.py +++ b/test/cinn/op_mappers/test_logical_op.py @@ -15,8 +15,10 @@ # limitations under the License. import unittest + import numpy as np from op_mapper_test import OpMapperTest, logger + 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 fb10ec54d5d..bbeac7a6cf3 100644 --- a/test/cinn/op_mappers/test_lookup_table_op.py +++ b/test/cinn/op_mappers/test_lookup_table_op.py @@ -13,8 +13,10 @@ # limitations under the License. import unittest + import numpy as np from op_mapper_test import OpMapperTest, logger + import paddle diff --git a/test/cinn/op_mappers/test_mul_op.py b/test/cinn/op_mappers/test_mul_op.py index 5055ac654d2..2a35177e874 100644 --- a/test/cinn/op_mappers/test_mul_op.py +++ b/test/cinn/op_mappers/test_mul_op.py @@ -15,8 +15,10 @@ # limitations under the License. import unittest + import numpy as np from op_mapper_test import OpMapperTest, logger + import paddle diff --git a/test/cinn/op_mappers/test_norm_op.py b/test/cinn/op_mappers/test_norm_op.py index 22130645cc3..d48ba95d325 100644 --- a/test/cinn/op_mappers/test_norm_op.py +++ b/test/cinn/op_mappers/test_norm_op.py @@ -15,8 +15,10 @@ # limitations under the License. import unittest + import numpy as np from op_mapper_test import OpMapperTest, logger + 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 c7e1c058aed..c323e138f7b 100644 --- a/test/cinn/op_mappers/test_one_hot_op.py +++ b/test/cinn/op_mappers/test_one_hot_op.py @@ -13,8 +13,10 @@ # limitations under the License. import unittest + import numpy as np from op_mapper_test import OpMapperTest, logger + import paddle diff --git a/test/cinn/op_mappers/test_pool2d_op.py b/test/cinn/op_mappers/test_pool2d_op.py index 592650114d0..457953b05d8 100644 --- a/test/cinn/op_mappers/test_pool2d_op.py +++ b/test/cinn/op_mappers/test_pool2d_op.py @@ -13,9 +13,11 @@ # limitations under the License. import unittest -import paddle -from op_mapper_test import OpMapperTest + from cinn.common import * +from op_mapper_test import OpMapperTest + +import paddle @unittest.skipIf( diff --git a/test/cinn/op_mappers/test_pow_op.py b/test/cinn/op_mappers/test_pow_op.py index 2a269a86bd4..b60727d746c 100644 --- a/test/cinn/op_mappers/test_pow_op.py +++ b/test/cinn/op_mappers/test_pow_op.py @@ -15,8 +15,10 @@ # limitations under the License. import unittest + import numpy as np from op_mapper_test import OpMapperTest, logger + import paddle diff --git a/test/cinn/op_mappers/test_randint_op.py b/test/cinn/op_mappers/test_randint_op.py index 5da40d7ad05..d1d63cee630 100644 --- a/test/cinn/op_mappers/test_randint_op.py +++ b/test/cinn/op_mappers/test_randint_op.py @@ -15,8 +15,10 @@ # limitations under the License. import unittest + import numpy as np from op_mapper_test import OpMapperTest, logger + import paddle diff --git a/test/cinn/op_mappers/test_reduce_op.py b/test/cinn/op_mappers/test_reduce_op.py index 7b4e17ec4aa..3a1d4738929 100644 --- a/test/cinn/op_mappers/test_reduce_op.py +++ b/test/cinn/op_mappers/test_reduce_op.py @@ -15,8 +15,10 @@ # limitations under the License. import unittest + import numpy as np from op_mapper_test import OpMapperTest, logger + import paddle diff --git a/test/cinn/op_mappers/test_reverse_op.py b/test/cinn/op_mappers/test_reverse_op.py index b83be8b5f5b..f4da33b1755 100644 --- a/test/cinn/op_mappers/test_reverse_op.py +++ b/test/cinn/op_mappers/test_reverse_op.py @@ -15,7 +15,9 @@ # limitations under the License. import unittest + 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 94f274fb20e..6eaa6bf054a 100644 --- a/test/cinn/op_mappers/test_roll_op.py +++ b/test/cinn/op_mappers/test_roll_op.py @@ -15,8 +15,10 @@ # limitations under the License. import unittest + import numpy as np from op_mapper_test import OpMapperTest, logger + import paddle diff --git a/test/cinn/op_mappers/test_scale_op.py b/test/cinn/op_mappers/test_scale_op.py index afc688a4558..d15c1ff4e28 100644 --- a/test/cinn/op_mappers/test_scale_op.py +++ b/test/cinn/op_mappers/test_scale_op.py @@ -15,8 +15,10 @@ # limitations under the License. import unittest + import numpy as np from op_mapper_test import OpMapperTest, logger + import paddle diff --git a/test/cinn/op_mappers/test_scatter_op.py b/test/cinn/op_mappers/test_scatter_op.py index 8197e631e1e..05bc2475510 100644 --- a/test/cinn/op_mappers/test_scatter_op.py +++ b/test/cinn/op_mappers/test_scatter_op.py @@ -14,12 +14,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -import numpy as np -import paddle import random import unittest + +import numpy as np from op_mapper_test import OpMapperTest +import paddle + class TestScatterOp(OpMapperTest): def init_input_data(self): diff --git a/test/cinn/op_mappers/test_sign_op.py b/test/cinn/op_mappers/test_sign_op.py index d133f99c7f8..c732aaaa229 100644 --- a/test/cinn/op_mappers/test_sign_op.py +++ b/test/cinn/op_mappers/test_sign_op.py @@ -15,8 +15,10 @@ # limitations under the License. import unittest + import numpy as np from op_mapper_test import OpMapperTest, logger + import paddle diff --git a/test/cinn/op_mappers/test_split_op.py b/test/cinn/op_mappers/test_split_op.py index 118db929954..e73f1302ee6 100644 --- a/test/cinn/op_mappers/test_split_op.py +++ b/test/cinn/op_mappers/test_split_op.py @@ -15,8 +15,10 @@ # limitations under the License. import unittest + import numpy as np from op_mapper_test import OpMapperTest, logger + import paddle diff --git a/test/cinn/op_mappers/test_squeeze_op.py b/test/cinn/op_mappers/test_squeeze_op.py index 7d2d5837e14..7acb33c029a 100644 --- a/test/cinn/op_mappers/test_squeeze_op.py +++ b/test/cinn/op_mappers/test_squeeze_op.py @@ -15,8 +15,10 @@ # limitations under the License. import unittest + import numpy as np from op_mapper_test import OpMapperTest, logger + import paddle diff --git a/test/cinn/op_mappers/test_stack_op.py b/test/cinn/op_mappers/test_stack_op.py index 48917f8be08..06cb4bf6e7b 100644 --- a/test/cinn/op_mappers/test_stack_op.py +++ b/test/cinn/op_mappers/test_stack_op.py @@ -15,8 +15,10 @@ # limitations under the License. import unittest + import numpy as np from op_mapper_test import OpMapperTest, logger + 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 5994807bc22..2f1fb248ad8 100644 --- a/test/cinn/op_mappers/test_strided_slice_op.py +++ b/test/cinn/op_mappers/test_strided_slice_op.py @@ -15,8 +15,10 @@ # limitations under the License. import unittest + import numpy as np from op_mapper_test import OpMapperTest, logger + import paddle diff --git a/test/cinn/op_mappers/test_take_along_axis_op.py b/test/cinn/op_mappers/test_take_along_axis_op.py index 1312117e19d..9314ea8b252 100644 --- a/test/cinn/op_mappers/test_take_along_axis_op.py +++ b/test/cinn/op_mappers/test_take_along_axis_op.py @@ -13,8 +13,10 @@ # limitations under the License. import unittest + import numpy as np 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 baffa7ddd6d..75b04947a0e 100644 --- a/test/cinn/op_mappers/test_tile_op.py +++ b/test/cinn/op_mappers/test_tile_op.py @@ -15,8 +15,10 @@ # limitations under the License. import unittest + import numpy as np from op_mapper_test import OpMapperTest, logger + import paddle diff --git a/test/cinn/op_mappers/test_transpose2_op.py b/test/cinn/op_mappers/test_transpose2_op.py index eabbf3e5373..6b47934a3ba 100644 --- a/test/cinn/op_mappers/test_transpose2_op.py +++ b/test/cinn/op_mappers/test_transpose2_op.py @@ -15,8 +15,10 @@ # limitations under the License. import unittest + import numpy as np from op_mapper_test import OpMapperTest, logger + import paddle diff --git a/test/cinn/op_mappers/test_triangular_solve_op.py b/test/cinn/op_mappers/test_triangular_solve_op.py index 0319e4a1de1..61814bef386 100644 --- a/test/cinn/op_mappers/test_triangular_solve_op.py +++ b/test/cinn/op_mappers/test_triangular_solve_op.py @@ -15,7 +15,9 @@ # limitations under the License. import unittest + 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 f76022d5407..b6b5fb8bf11 100644 --- a/test/cinn/op_mappers/test_unary_op.py +++ b/test/cinn/op_mappers/test_unary_op.py @@ -15,8 +15,10 @@ # limitations under the License. import unittest + import numpy as np from op_mapper_test import OpMapperTest, logger + 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 3d4cea09b35..2bd45318971 100644 --- a/test/cinn/op_mappers/test_uniform_random_op.py +++ b/test/cinn/op_mappers/test_uniform_random_op.py @@ -15,8 +15,10 @@ # limitations under the License. import unittest + import numpy as np from op_mapper_test import OpMapperTest, logger + import paddle diff --git a/test/cinn/op_mappers/test_where_op.py b/test/cinn/op_mappers/test_where_op.py index 5dfe9041537..4398e9e6af9 100644 --- a/test/cinn/op_mappers/test_where_op.py +++ b/test/cinn/op_mappers/test_where_op.py @@ -15,8 +15,10 @@ # limitations under the License. import unittest + import numpy as np from op_mapper_test import OpMapperTest, logger + import paddle diff --git a/test/cinn/ops/op_test.py b/test/cinn/ops/op_test.py index 2b081b09c6c..398a3e79721 100755 --- a/test/cinn/ops/op_test.py +++ b/test/cinn/ops/op_test.py @@ -12,18 +12,19 @@ # See the License for the specific language governing permissions and # limitations under the License. +import logging +import os +import struct import unittest +from contextlib import contextmanager + +import numpy as np from cinn import Target -from cinn.frontend import * from cinn.common import * +from cinn.frontend import * from cinn.runtime import seed as cinn_seed -import numpy as np -import paddle -import logging -from contextlib import contextmanager -import os -import struct +import paddle logging.basicConfig(level=os.environ.get('LOG_LEVEL', 'INFO').upper()) logger = logging.getLogger(name="op_test") diff --git a/test/cinn/ops/op_test_helper.py b/test/cinn/ops/op_test_helper.py index 5150790bacb..65dd762f4f4 100644 --- a/test/cinn/ops/op_test_helper.py +++ b/test/cinn/ops/op_test_helper.py @@ -12,14 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import sys import argparse import itertools -import unittest import re - +import sys +import unittest +from typing import List, Union from unittest import suite -from typing import Union, List parser = argparse.ArgumentParser(description="Argparse for op test helper") parser.add_argument( diff --git a/test/cinn/ops/test_abs_op.py b/test/cinn/ops/test_abs_op.py index 31ca154d3e9..10f12c2b9e7 100644 --- a/test/cinn/ops/test_abs_op.py +++ b/test/cinn/ops/test_abs_op.py @@ -15,11 +15,13 @@ # limitations under the License. import unittest + +from cinn.common import * +from cinn.frontend import * from op_test import OpTest, OpTestTool from op_test_helper import TestCaseHelper + import paddle -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_acos_op.py b/test/cinn/ops/test_acos_op.py index f953e990f16..afb692c6d8a 100644 --- a/test/cinn/ops/test_acos_op.py +++ b/test/cinn/ops/test_acos_op.py @@ -13,13 +13,15 @@ # 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 cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_acosh_op.py b/test/cinn/ops/test_acosh_op.py index f0c4bc15cc4..0e3cd2b3300 100644 --- a/test/cinn/ops/test_acosh_op.py +++ b/test/cinn/ops/test_acosh_op.py @@ -13,13 +13,15 @@ # 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 cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_add_op.py b/test/cinn/ops/test_add_op.py index 73759bf2ff5..084f015214a 100644 --- a/test/cinn/ops/test_add_op.py +++ b/test/cinn/ops/test_add_op.py @@ -13,12 +13,13 @@ # limitations under the License. import numpy as np -import paddle from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool from op_test_helper import TestCaseHelper +import paddle + @OpTestTool.skip_if( not is_compiled_with_cuda(), "x86 test will be skipped due to timeout." diff --git a/test/cinn/ops/test_arange_op.py b/test/cinn/ops/test_arange_op.py index 6c7c38ca7c1..301e655b3cc 100644 --- a/test/cinn/ops/test_arange_op.py +++ b/test/cinn/ops/test_arange_op.py @@ -14,12 +14,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle -from cinn.frontend import * from cinn.common import * +from cinn.frontend import * from op_test import OpTest, OpTestTool from op_test_helper import TestCaseHelper +import paddle + @OpTestTool.skip_if( not is_compiled_with_cuda(), "x86 test will be skipped due to timeout." diff --git a/test/cinn/ops/test_argsort_op.py b/test/cinn/ops/test_argsort_op.py index 26c1bb3bc85..b7e394afa02 100644 --- a/test/cinn/ops/test_argsort_op.py +++ b/test/cinn/ops/test_argsort_op.py @@ -15,13 +15,15 @@ # 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 import paddle.nn.functional as F -import cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_asin_op.py b/test/cinn/ops/test_asin_op.py index c9a89ea2328..11426a57e8a 100644 --- a/test/cinn/ops/test_asin_op.py +++ b/test/cinn/ops/test_asin_op.py @@ -14,13 +14,14 @@ # 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 from op_test_helper import TestCaseHelper + import paddle -import cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_asinh_op.py b/test/cinn/ops/test_asinh_op.py index 791513b7fa7..7622c34d085 100644 --- a/test/cinn/ops/test_asinh_op.py +++ b/test/cinn/ops/test_asinh_op.py @@ -13,13 +13,15 @@ # 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 cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_atan2_op.py b/test/cinn/ops/test_atan2_op.py index de23e3709bc..b43b582ef58 100644 --- a/test/cinn/ops/test_atan2_op.py +++ b/test/cinn/ops/test_atan2_op.py @@ -12,11 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. +from cinn.common import * +from cinn.frontend import * from op_test import OpTest, OpTestTool from op_test_helper import TestCaseHelper + import paddle -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_atan_op.py b/test/cinn/ops/test_atan_op.py index 04bd1c03cbd..81574ebe20a 100644 --- a/test/cinn/ops/test_atan_op.py +++ b/test/cinn/ops/test_atan_op.py @@ -13,13 +13,15 @@ # 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 cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_atanh_op.py b/test/cinn/ops/test_atanh_op.py index 73010230047..b53fee7a96a 100644 --- a/test/cinn/ops/test_atanh_op.py +++ b/test/cinn/ops/test_atanh_op.py @@ -13,13 +13,15 @@ # 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 cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_batch_norm_op.py b/test/cinn/ops/test_batch_norm_op.py index af0d5a761d5..8c57a9cd88d 100644 --- a/test/cinn/ops/test_batch_norm_op.py +++ b/test/cinn/ops/test_batch_norm_op.py @@ -14,14 +14,17 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest, sys +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_helper import TestCaseHelper + import paddle -import cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_binary_elementwise_op.py b/test/cinn/ops/test_binary_elementwise_op.py index bf06d515d13..045785982fc 100644 --- a/test/cinn/ops/test_binary_elementwise_op.py +++ b/test/cinn/ops/test_binary_elementwise_op.py @@ -15,12 +15,14 @@ # 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 -import cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_bitcast_convert_op.py b/test/cinn/ops/test_bitcast_convert_op.py index 7294c07265b..2da4aed7cc7 100644 --- a/test/cinn/ops/test_bitcast_convert_op.py +++ b/test/cinn/ops/test_bitcast_convert_op.py @@ -13,14 +13,15 @@ # limitations under the License. import unittest -import numpy as np -from op_test import OpTest, OpTestTool -import paddle +from struct import pack, unpack + import cinn -from cinn.frontend import * +import numpy as np from cinn.common import * +from cinn.frontend import * +from op_test import OpTest, OpTestTool -from struct import pack, unpack +import paddle @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_bitwise_op.py b/test/cinn/ops/test_bitwise_op.py index a167a8e05a3..f7e7611e2de 100644 --- a/test/cinn/ops/test_bitwise_op.py +++ b/test/cinn/ops/test_bitwise_op.py @@ -13,11 +13,12 @@ # limitations under the License. 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 -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_broadcast_to_op.py b/test/cinn/ops/test_broadcast_to_op.py index bf47eb422a5..3536355ac69 100644 --- a/test/cinn/ops/test_broadcast_to_op.py +++ b/test/cinn/ops/test_broadcast_to_op.py @@ -14,14 +14,16 @@ # 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 + import paddle -import cinn -from cinn.frontend import * -from cinn.common import * -import sys class TestBroadcastToOp(OpTest): diff --git a/test/cinn/ops/test_broadcast_to_op_new.py b/test/cinn/ops/test_broadcast_to_op_new.py index bf561f548fa..6878928226c 100644 --- a/test/cinn/ops/test_broadcast_to_op_new.py +++ b/test/cinn/ops/test_broadcast_to_op_new.py @@ -14,11 +14,12 @@ # See the License for the specific language governing permissions and # limitations under the License. +from cinn.common import * +from cinn.frontend import * from op_test import OpTest, OpTestTool from op_test_helper import TestCaseHelper + import paddle -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_cast_op.py b/test/cinn/ops/test_cast_op.py index e1598f37309..99a4a4f8630 100644 --- a/test/cinn/ops/test_cast_op.py +++ b/test/cinn/ops/test_cast_op.py @@ -15,13 +15,15 @@ # 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 cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_cbrt_op.py b/test/cinn/ops/test_cbrt_op.py index 4a290958783..a8d51446951 100644 --- a/test/cinn/ops/test_cbrt_op.py +++ b/test/cinn/ops/test_cbrt_op.py @@ -14,13 +14,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle 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 + @OpTestTool.skip_if( not is_compiled_with_cuda(), "x86 test will be skipped due to timeout." diff --git a/test/cinn/ops/test_ceil_op.py b/test/cinn/ops/test_ceil_op.py index 0ea621eaced..9d9de3cead1 100644 --- a/test/cinn/ops/test_ceil_op.py +++ b/test/cinn/ops/test_ceil_op.py @@ -14,12 +14,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool from op_test_helper import TestCaseHelper +import paddle + @OpTestTool.skip_if( not is_compiled_with_cuda(), "x86 test will be skipped due to timeout." diff --git a/test/cinn/ops/test_cholesky_op.py b/test/cinn/ops/test_cholesky_op.py index dbc5247d0bd..ff6b3093644 100644 --- a/test/cinn/ops/test_cholesky_op.py +++ b/test/cinn/ops/test_cholesky_op.py @@ -15,12 +15,13 @@ # limitations under the License. import numpy as np -import paddle from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool from op_test_helper import TestCaseHelper +import paddle + @OpTestTool.skip_if( not is_compiled_with_cuda(), "x86 test will be skipped due to timeout." diff --git a/test/cinn/ops/test_clz_op.py b/test/cinn/ops/test_clz_op.py index 6db20ad54b4..ad0b1be8a70 100644 --- a/test/cinn/ops/test_clz_op.py +++ b/test/cinn/ops/test_clz_op.py @@ -15,12 +15,13 @@ # limitations under the License. import numpy as np -import paddle from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool from op_test_helper import TestCaseHelper +import paddle + INT32_MAX = (1 << 31) - 1 INT32_MIN = -(1 << 31) INT64_MAX = (1 << 63) - 1 diff --git a/test/cinn/ops/test_comparison_op.py b/test/cinn/ops/test_comparison_op.py index e12c97885a4..45c9e08817e 100644 --- a/test/cinn/ops/test_comparison_op.py +++ b/test/cinn/ops/test_comparison_op.py @@ -12,12 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle -from cinn.frontend import * from cinn.common import * +from cinn.frontend import * from op_test import OpTest, OpTestTool from op_test_helper import TestCaseHelper +import paddle + @OpTestTool.skip_if( not is_compiled_with_cuda(), "x86 test will be skipped due to timeout." diff --git a/test/cinn/ops/test_concat_op.py b/test/cinn/ops/test_concat_op.py index af143982aae..57117a983d9 100755 --- a/test/cinn/ops/test_concat_op.py +++ b/test/cinn/ops/test_concat_op.py @@ -14,12 +14,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool from op_test_helper import TestCaseHelper +import paddle + @OpTestTool.skip_if( not is_compiled_with_cuda(), "x86 test will be skipped due to timeout." diff --git a/test/cinn/ops/test_constant_op.py b/test/cinn/ops/test_constant_op.py index fcedbe758bc..eafd3100d2d 100644 --- a/test/cinn/ops/test_constant_op.py +++ b/test/cinn/ops/test_constant_op.py @@ -14,12 +14,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool from op_test_helper import TestCaseHelper +import paddle + @OpTestTool.skip_if( not is_compiled_with_cuda(), "x86 test will be skipped due to timeout." diff --git a/test/cinn/ops/test_conv2d_op.py b/test/cinn/ops/test_conv2d_op.py index 1a61cc02e00..a9a83c101cf 100755 --- a/test/cinn/ops/test_conv2d_op.py +++ b/test/cinn/ops/test_conv2d_op.py @@ -13,17 +13,18 @@ # 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 cinn -import numpy as np -import paddle import unittest -from cinn.frontend import * +import cinn +import numpy as np from cinn.common import * +from cinn.frontend import * from cinn.runtime import * from op_test import OpTest, OpTestTool from op_test_helper import TestCaseHelper +import paddle + set_cinn_cudnn_deterministic(True) paddle.fluid.set_flags({'FLAGS_cudnn_deterministic': 1}) diff --git a/test/cinn/ops/test_cos_op.py b/test/cinn/ops/test_cos_op.py index 4d2ac4ae037..eef3c2d05ea 100644 --- a/test/cinn/ops/test_cos_op.py +++ b/test/cinn/ops/test_cos_op.py @@ -14,13 +14,14 @@ # 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 from op_test_helper import TestCaseHelper + import paddle -import cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_cosh_op.py b/test/cinn/ops/test_cosh_op.py index 33bf608a6fd..672af4fca0a 100644 --- a/test/cinn/ops/test_cosh_op.py +++ b/test/cinn/ops/test_cosh_op.py @@ -14,13 +14,14 @@ # 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 from op_test_helper import TestCaseHelper + import paddle -import cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_depthwise_conv2d_op.py b/test/cinn/ops/test_depthwise_conv2d_op.py index 201ef9dcde6..03771916346 100644 --- a/test/cinn/ops/test_depthwise_conv2d_op.py +++ b/test/cinn/ops/test_depthwise_conv2d_op.py @@ -12,13 +12,14 @@ # 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 from op_test_helper import TestCaseHelper + import paddle import paddle.nn as nn -import cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_divide_op.py b/test/cinn/ops/test_divide_op.py index 39c312b2e8e..3dc8cf74f0e 100644 --- a/test/cinn/ops/test_divide_op.py +++ b/test/cinn/ops/test_divide_op.py @@ -14,12 +14,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle -from cinn.frontend import * from cinn.common import * +from cinn.frontend import * from op_test import OpTest, OpTestTool from op_test_helper import TestCaseHelper +import paddle + @OpTestTool.skip_if( not is_compiled_with_cuda(), "x86 test will be skipped due to timeout." diff --git a/test/cinn/ops/test_dropout_infer_op.py b/test/cinn/ops/test_dropout_infer_op.py index 4c3f605985b..b9bc5d9680b 100644 --- a/test/cinn/ops/test_dropout_infer_op.py +++ b/test/cinn/ops/test_dropout_infer_op.py @@ -13,13 +13,15 @@ # 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 cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_erf_op.py b/test/cinn/ops/test_erf_op.py index 46ca1b58db3..860c1a17de8 100644 --- a/test/cinn/ops/test_erf_op.py +++ b/test/cinn/ops/test_erf_op.py @@ -14,13 +14,14 @@ # 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 from op_test_helper import TestCaseHelper + import paddle -import cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_exp_op.py b/test/cinn/ops/test_exp_op.py index 46654c0630e..f25577d2868 100644 --- a/test/cinn/ops/test_exp_op.py +++ b/test/cinn/ops/test_exp_op.py @@ -14,13 +14,14 @@ # 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 from op_test_helper import TestCaseHelper + import paddle -import cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_expand_dims.py b/test/cinn/ops/test_expand_dims.py index f4cb18a8974..0b77d7eb5a8 100644 --- a/test/cinn/ops/test_expand_dims.py +++ b/test/cinn/ops/test_expand_dims.py @@ -14,11 +14,12 @@ # See the License for the specific language governing permissions and # limitations under the License. +from cinn.common import * +from cinn.frontend import * from op_test import OpTest, OpTestTool from op_test_helper import TestCaseHelper + import paddle -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_fill_constant_op.py b/test/cinn/ops/test_fill_constant_op.py index 9295499dca3..1c69f5574b2 100644 --- a/test/cinn/ops/test_fill_constant_op.py +++ b/test/cinn/ops/test_fill_constant_op.py @@ -14,13 +14,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle 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 + @OpTestTool.skip_if( not is_compiled_with_cuda(), "x86 test will be skipped due to timeout." diff --git a/test/cinn/ops/test_floor_divide_op.py b/test/cinn/ops/test_floor_divide_op.py index e7bc4f0a388..bef6dba1455 100644 --- a/test/cinn/ops/test_floor_divide_op.py +++ b/test/cinn/ops/test_floor_divide_op.py @@ -15,14 +15,16 @@ # 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 -import cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_floor_op.py b/test/cinn/ops/test_floor_op.py index 8c5dbdb43e6..24bbbab3bf2 100644 --- a/test/cinn/ops/test_floor_op.py +++ b/test/cinn/ops/test_floor_op.py @@ -14,13 +14,14 @@ # 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 from op_test_helper import TestCaseHelper + import paddle -import cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_gather_nd_op.py b/test/cinn/ops/test_gather_nd_op.py index d5258a4765f..16cd4a18d5a 100644 --- a/test/cinn/ops/test_gather_nd_op.py +++ b/test/cinn/ops/test_gather_nd_op.py @@ -14,16 +14,18 @@ # See the License for the specific language governing permissions and # limitations under the License. +import logging +import os import unittest +from itertools import product + +import cinn import numpy as np +from cinn.common import * +from cinn.frontend import * from op_test import OpTest, OpTestTool + import paddle -import cinn -from cinn.frontend import * -from cinn.common import * -import logging -import os -from itertools import product logging.basicConfig(level=os.environ.get('LOG_LEVEL', 'INFO').upper()) logger = logging.getLogger(name="gather_nd") diff --git a/test/cinn/ops/test_gather_op.py b/test/cinn/ops/test_gather_op.py index 1c054aade22..9f567cf0f3c 100644 --- a/test/cinn/ops/test_gather_op.py +++ b/test/cinn/ops/test_gather_op.py @@ -14,17 +14,19 @@ # See the License for the specific language governing permissions and # limitations under the License. +import logging +import os import unittest +from itertools import product + +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 cinn -from cinn.frontend import * -from cinn.common import * -import logging -import os -from itertools import product logging.basicConfig(level=os.environ.get('LOG_LEVEL', 'INFO').upper()) logger = logging.getLogger(name="gather") diff --git a/test/cinn/ops/test_gaussian_random_op.py b/test/cinn/ops/test_gaussian_random_op.py index 87fbd92339e..f62835ae811 100644 --- a/test/cinn/ops/test_gaussian_random_op.py +++ b/test/cinn/ops/test_gaussian_random_op.py @@ -14,12 +14,13 @@ # 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 from op_test_helper import TestCaseHelper + import paddle -import cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_gelu_op.py b/test/cinn/ops/test_gelu_op.py index c6a9b164d73..cd5971925de 100644 --- a/test/cinn/ops/test_gelu_op.py +++ b/test/cinn/ops/test_gelu_op.py @@ -15,14 +15,16 @@ # 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 -import cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_identity_op.py b/test/cinn/ops/test_identity_op.py index 6f0fc5eec86..683625506db 100644 --- a/test/cinn/ops/test_identity_op.py +++ b/test/cinn/ops/test_identity_op.py @@ -15,11 +15,13 @@ # limitations under the License. import unittest + +from cinn.common import * +from cinn.frontend import * from op_test import OpTest, OpTestTool from op_test_helper import TestCaseHelper + import paddle -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_is_finite_op.py b/test/cinn/ops/test_is_finite_op.py index 83860605714..12d64a0050f 100644 --- a/test/cinn/ops/test_is_finite_op.py +++ b/test/cinn/ops/test_is_finite_op.py @@ -14,13 +14,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -import numpy as np import unittest + +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 -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_is_inf_op.py b/test/cinn/ops/test_is_inf_op.py index 3468e98fb7a..ad3248e2998 100644 --- a/test/cinn/ops/test_is_inf_op.py +++ b/test/cinn/ops/test_is_inf_op.py @@ -14,13 +14,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -import numpy as np import unittest + +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 -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_is_nan_op.py b/test/cinn/ops/test_is_nan_op.py index a0afdc146be..bd0dfaa70ee 100644 --- a/test/cinn/ops/test_is_nan_op.py +++ b/test/cinn/ops/test_is_nan_op.py @@ -14,13 +14,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -import numpy as np import unittest + +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 -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_isclose_op.py b/test/cinn/ops/test_isclose_op.py index 58711160b8d..73bf8a7f649 100644 --- a/test/cinn/ops/test_isclose_op.py +++ b/test/cinn/ops/test_isclose_op.py @@ -14,13 +14,14 @@ # 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 from op_test_helper import TestCaseHelper + import paddle -import cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_left_shift_op.py b/test/cinn/ops/test_left_shift_op.py index 41c0e1f007b..57eb693dbce 100644 --- a/test/cinn/ops/test_left_shift_op.py +++ b/test/cinn/ops/test_left_shift_op.py @@ -13,13 +13,15 @@ # 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 cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_log_op.py b/test/cinn/ops/test_log_op.py index 8dff3212ed2..bb66e71f1b8 100644 --- a/test/cinn/ops/test_log_op.py +++ b/test/cinn/ops/test_log_op.py @@ -12,12 +12,13 @@ # 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 from op_test_helper import TestCaseHelper + import paddle -import cinn -from cinn.frontend import * -from cinn.common import * class TestLogOp(OpTest): diff --git a/test/cinn/ops/test_logical_and_op.py b/test/cinn/ops/test_logical_and_op.py index 184c144b33d..b7fcf7c5461 100644 --- a/test/cinn/ops/test_logical_and_op.py +++ b/test/cinn/ops/test_logical_and_op.py @@ -13,13 +13,15 @@ # 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 cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_logical_not_op.py b/test/cinn/ops/test_logical_not_op.py index 4f4f0b2331e..1e04ac6eaee 100644 --- a/test/cinn/ops/test_logical_not_op.py +++ b/test/cinn/ops/test_logical_not_op.py @@ -13,13 +13,15 @@ # 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 cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_logical_or_op.py b/test/cinn/ops/test_logical_or_op.py index 29a998f20f5..0b7344d53be 100644 --- a/test/cinn/ops/test_logical_or_op.py +++ b/test/cinn/ops/test_logical_or_op.py @@ -13,13 +13,15 @@ # 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 cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_logical_right_shift_op.py b/test/cinn/ops/test_logical_right_shift_op.py index 9bc8ee4d8be..52500698b8c 100644 --- a/test/cinn/ops/test_logical_right_shift_op.py +++ b/test/cinn/ops/test_logical_right_shift_op.py @@ -14,13 +14,14 @@ # 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 from op_test_helper import TestCaseHelper + import paddle -import cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_logical_xor_op.py b/test/cinn/ops/test_logical_xor_op.py index c214f79b955..b216c6a7a7d 100644 --- a/test/cinn/ops/test_logical_xor_op.py +++ b/test/cinn/ops/test_logical_xor_op.py @@ -13,13 +13,15 @@ # 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 cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_lookup_table_op.py b/test/cinn/ops/test_lookup_table_op.py index f90335ddea9..21eec9de763 100644 --- a/test/cinn/ops/test_lookup_table_op.py +++ b/test/cinn/ops/test_lookup_table_op.py @@ -14,13 +14,14 @@ # 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 from op_test_helper import TestCaseHelper + import paddle import paddle.nn.functional as F -import cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_matmul_op.py b/test/cinn/ops/test_matmul_op.py index 94b8bc87ad1..a4c2d4bec94 100755 --- a/test/cinn/ops/test_matmul_op.py +++ b/test/cinn/ops/test_matmul_op.py @@ -15,14 +15,16 @@ # 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 -import cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_max_op.py b/test/cinn/ops/test_max_op.py index 665869113be..a958958c863 100644 --- a/test/cinn/ops/test_max_op.py +++ b/test/cinn/ops/test_max_op.py @@ -14,11 +14,12 @@ # See the License for the specific language governing permissions and # limitations under the License. +from cinn.common import * +from cinn.frontend import * from op_test import OpTest, OpTestTool from op_test_helper import TestCaseHelper + import paddle -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_min_op.py b/test/cinn/ops/test_min_op.py index 47ebdec3cea..a9847efc060 100644 --- a/test/cinn/ops/test_min_op.py +++ b/test/cinn/ops/test_min_op.py @@ -14,11 +14,12 @@ # See the License for the specific language governing permissions and # limitations under the License. +from cinn.common import * +from cinn.frontend import * from op_test import OpTest, OpTestTool from op_test_helper import TestCaseHelper + import paddle -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_mod_op.py b/test/cinn/ops/test_mod_op.py index 89cc8496000..b93e9481a3d 100644 --- a/test/cinn/ops/test_mod_op.py +++ b/test/cinn/ops/test_mod_op.py @@ -15,13 +15,15 @@ # 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 cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_mul_op.py b/test/cinn/ops/test_mul_op.py index 9566981b074..1d0149309ff 100755 --- a/test/cinn/ops/test_mul_op.py +++ b/test/cinn/ops/test_mul_op.py @@ -14,15 +14,17 @@ # 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 + import paddle import paddle.nn.functional as F -import cinn -from cinn.frontend import * -from cinn.common import * -import sys @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_multiply_op.py b/test/cinn/ops/test_multiply_op.py index 85e254909e6..182323166e3 100644 --- a/test/cinn/ops/test_multiply_op.py +++ b/test/cinn/ops/test_multiply_op.py @@ -15,11 +15,12 @@ # limitations under the License. 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 -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_negative_op.py b/test/cinn/ops/test_negative_op.py index a725bf1130c..f8d8b7ecd29 100644 --- a/test/cinn/ops/test_negative_op.py +++ b/test/cinn/ops/test_negative_op.py @@ -14,13 +14,14 @@ # 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 from op_test_helper import TestCaseHelper + import paddle -import cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_one_hot_op.py b/test/cinn/ops/test_one_hot_op.py index 1cf7927a2e1..02d5f4502e1 100755 --- a/test/cinn/ops/test_one_hot_op.py +++ b/test/cinn/ops/test_one_hot_op.py @@ -15,14 +15,16 @@ # 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 -import cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_pool2d_op.py b/test/cinn/ops/test_pool2d_op.py index 819f6a8bf6b..eb5ff95167a 100644 --- a/test/cinn/ops/test_pool2d_op.py +++ b/test/cinn/ops/test_pool2d_op.py @@ -14,11 +14,12 @@ # See the License for the specific language governing permissions and # limitations under the License. +from cinn.common import * +from cinn.frontend import * from op_test import OpTest, OpTestTool from op_test_helper import TestCaseHelper + import paddle -from cinn.frontend import * -from cinn.common import * from paddle import _C_ops diff --git a/test/cinn/ops/test_popc_op.py b/test/cinn/ops/test_popc_op.py index 4f83469e249..a1cba471439 100644 --- a/test/cinn/ops/test_popc_op.py +++ b/test/cinn/ops/test_popc_op.py @@ -15,12 +15,13 @@ # limitations under the License. import numpy as np -import paddle from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool from op_test_helper import TestCaseHelper +import paddle + INT32_MAX = (1 << 31) - 1 INT32_MIN = -(1 << 31) INT64_MAX = (1 << 63) - 1 diff --git a/test/cinn/ops/test_pow_op.py b/test/cinn/ops/test_pow_op.py index c55557b525a..c02afc72676 100644 --- a/test/cinn/ops/test_pow_op.py +++ b/test/cinn/ops/test_pow_op.py @@ -14,13 +14,14 @@ # 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 from op_test_helper import TestCaseHelper + import paddle -import cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_randint_op.py b/test/cinn/ops/test_randint_op.py index 3bee6ae239c..4a88a8e50fe 100644 --- a/test/cinn/ops/test_randint_op.py +++ b/test/cinn/ops/test_randint_op.py @@ -14,14 +14,16 @@ # See the License for the specific language governing permissions and # limitations under the License. -from random import seed 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 + import paddle -import cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_reciprocal_op.py b/test/cinn/ops/test_reciprocal_op.py index 849809a1ac0..45679b4ec4e 100644 --- a/test/cinn/ops/test_reciprocal_op.py +++ b/test/cinn/ops/test_reciprocal_op.py @@ -13,13 +13,15 @@ # 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 cinn -from cinn.frontend import * -from cinn.common import * class TestReciprocalOp(OpTest): diff --git a/test/cinn/ops/test_reduce_op.py b/test/cinn/ops/test_reduce_op.py index 312998b3f36..fca5d316050 100644 --- a/test/cinn/ops/test_reduce_op.py +++ b/test/cinn/ops/test_reduce_op.py @@ -15,12 +15,14 @@ # 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 -import cinn -from cinn.frontend import * -from cinn.common import * paddle.seed(2) np.random.seed(2) diff --git a/test/cinn/ops/test_reduce_op_new.py b/test/cinn/ops/test_reduce_op_new.py index 836585e6f75..105a56c5bc5 100644 --- a/test/cinn/ops/test_reduce_op_new.py +++ b/test/cinn/ops/test_reduce_op_new.py @@ -13,13 +13,15 @@ # 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 cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_relu6_op.py b/test/cinn/ops/test_relu6_op.py index 589d0c0c094..bb9faad7770 100644 --- a/test/cinn/ops/test_relu6_op.py +++ b/test/cinn/ops/test_relu6_op.py @@ -13,13 +13,15 @@ # 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 cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_relu_op.py b/test/cinn/ops/test_relu_op.py index 4de04362ace..e5b5a6afe58 100755 --- a/test/cinn/ops/test_relu_op.py +++ b/test/cinn/ops/test_relu_op.py @@ -14,13 +14,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle -import paddle.nn.functional as F -from cinn.frontend import * 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( not is_compiled_with_cuda(), "x86 test will be skipped due to timeout." diff --git a/test/cinn/ops/test_remainder_op.py b/test/cinn/ops/test_remainder_op.py index 3efeef6fb5f..dbbbca33b27 100644 --- a/test/cinn/ops/test_remainder_op.py +++ b/test/cinn/ops/test_remainder_op.py @@ -14,13 +14,14 @@ # 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 from op_test_helper import TestCaseHelper + import paddle -import cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_repeat_op.py b/test/cinn/ops/test_repeat_op.py index 59035a3d35b..10463d6af4f 100644 --- a/test/cinn/ops/test_repeat_op.py +++ b/test/cinn/ops/test_repeat_op.py @@ -14,13 +14,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle import numpy as np -from cinn.frontend import * from cinn.common import * +from cinn.frontend import * from op_test import OpTest, OpTestTool from op_test_helper import TestCaseHelper +import paddle + @OpTestTool.skip_if( not is_compiled_with_cuda(), "x86 test will be skipped due to timeout." diff --git a/test/cinn/ops/test_reshape_op.py b/test/cinn/ops/test_reshape_op.py index b31ed9def50..88152363d3f 100644 --- a/test/cinn/ops/test_reshape_op.py +++ b/test/cinn/ops/test_reshape_op.py @@ -14,12 +14,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle -from cinn.frontend import * from cinn.common import * +from cinn.frontend import * from op_test import OpTest, OpTestTool from op_test_helper import TestCaseHelper +import paddle + @OpTestTool.skip_if( not is_compiled_with_cuda(), "x86 test will be skipped due to timeout." diff --git a/test/cinn/ops/test_resize_op.py b/test/cinn/ops/test_resize_op.py index 977b7422006..dd3ab475d04 100644 --- a/test/cinn/ops/test_resize_op.py +++ b/test/cinn/ops/test_resize_op.py @@ -15,12 +15,14 @@ # 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 -import cinn -from cinn.frontend import * -from cinn.common import * from paddle.vision.transforms import functional as F # paddle resize is based on cv2 module diff --git a/test/cinn/ops/test_reverse_op.py b/test/cinn/ops/test_reverse_op.py index 532c3e29678..83b6e4390bf 100755 --- a/test/cinn/ops/test_reverse_op.py +++ b/test/cinn/ops/test_reverse_op.py @@ -14,12 +14,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle from cinn.common import * from cinn.frontend import * from op_test import OpTest, OpTestTool from op_test_helper import TestCaseHelper +import paddle + @OpTestTool.skip_if( not is_compiled_with_cuda(), "x86 test will be skipped due to timeout." diff --git a/test/cinn/ops/test_right_shift_op.py b/test/cinn/ops/test_right_shift_op.py index 61efdc0602c..e4ac9a2fb40 100644 --- a/test/cinn/ops/test_right_shift_op.py +++ b/test/cinn/ops/test_right_shift_op.py @@ -13,13 +13,15 @@ # 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 cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_round_op.py b/test/cinn/ops/test_round_op.py index 81abd785ec4..0da35d93d4d 100644 --- a/test/cinn/ops/test_round_op.py +++ b/test/cinn/ops/test_round_op.py @@ -12,12 +12,13 @@ # 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 from op_test_helper import TestCaseHelper + import paddle -import cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_rsqrt_op.py b/test/cinn/ops/test_rsqrt_op.py index bb40c581965..8c1c13937eb 100644 --- a/test/cinn/ops/test_rsqrt_op.py +++ b/test/cinn/ops/test_rsqrt_op.py @@ -14,13 +14,14 @@ # 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 from op_test_helper import TestCaseHelper + import paddle -import cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_scale_op.py b/test/cinn/ops/test_scale_op.py index a4f431529fd..35f101cd6e1 100644 --- a/test/cinn/ops/test_scale_op.py +++ b/test/cinn/ops/test_scale_op.py @@ -13,13 +13,15 @@ # 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 cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_scatter_add.py b/test/cinn/ops/test_scatter_add.py index 0bbe8cefbc2..db1fdc935e2 100644 --- a/test/cinn/ops/test_scatter_add.py +++ b/test/cinn/ops/test_scatter_add.py @@ -14,12 +14,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle -from cinn.frontend import * from cinn.common import * +from cinn.frontend import * from op_test import OpTest, OpTestTool from op_test_helper import TestCaseHelper, run_test +import paddle + @OpTestTool.skip_if( not is_compiled_with_cuda(), "x86 test will be skipped due to timeout." diff --git a/test/cinn/ops/test_scatter_assign_op.py b/test/cinn/ops/test_scatter_assign_op.py index c170910d514..253e6fc1a8a 100644 --- a/test/cinn/ops/test_scatter_assign_op.py +++ b/test/cinn/ops/test_scatter_assign_op.py @@ -15,12 +15,13 @@ # limitations under the License. import numpy as np -import paddle -from cinn.frontend import * from cinn.common import * +from cinn.frontend import * from op_test import OpTest, OpTestTool from op_test_helper import TestCaseHelper +import paddle + @OpTestTool.skip_if( not is_compiled_with_cuda(), "x86 test will be skipped due to timeout." diff --git a/test/cinn/ops/test_select_op.py b/test/cinn/ops/test_select_op.py index 6264d6607f3..19ccbcb8df3 100644 --- a/test/cinn/ops/test_select_op.py +++ b/test/cinn/ops/test_select_op.py @@ -12,12 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle -from cinn.frontend import * from cinn.common import * +from cinn.frontend import * from op_test import OpTest, OpTestTool from op_test_helper import TestCaseHelper +import paddle + @OpTestTool.skip_if( not is_compiled_with_cuda(), "x86 test will be skipped due to timeout." diff --git a/test/cinn/ops/test_sigmoid_op.py b/test/cinn/ops/test_sigmoid_op.py index c4655b588c8..e7d91fbfe13 100644 --- a/test/cinn/ops/test_sigmoid_op.py +++ b/test/cinn/ops/test_sigmoid_op.py @@ -14,13 +14,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle -import paddle.nn.functional as F -from cinn.frontend import * 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( not is_compiled_with_cuda(), "x86 test will be skipped due to timeout." diff --git a/test/cinn/ops/test_sign_op.py b/test/cinn/ops/test_sign_op.py index 8a0b5d8233e..87fc1cb7cff 100644 --- a/test/cinn/ops/test_sign_op.py +++ b/test/cinn/ops/test_sign_op.py @@ -15,12 +15,13 @@ # limitations under the License. import numpy as np -import paddle -from cinn.frontend import * from cinn.common import * +from cinn.frontend import * from op_test import OpTest, OpTestTool from op_test_helper import TestCaseHelper +import paddle + @OpTestTool.skip_if( not is_compiled_with_cuda(), "x86 test will be skipped due to timeout." diff --git a/test/cinn/ops/test_sin_op.py b/test/cinn/ops/test_sin_op.py index 73dc2d8af0e..adb0385cda0 100644 --- a/test/cinn/ops/test_sin_op.py +++ b/test/cinn/ops/test_sin_op.py @@ -14,13 +14,14 @@ # 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 from op_test_helper import TestCaseHelper + import paddle -import cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_sinh_op.py b/test/cinn/ops/test_sinh_op.py index 747395e4c06..66e2675d7fe 100644 --- a/test/cinn/ops/test_sinh_op.py +++ b/test/cinn/ops/test_sinh_op.py @@ -14,13 +14,14 @@ # 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 from op_test_helper import TestCaseHelper + import paddle -import cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_slice_assign_op.py b/test/cinn/ops/test_slice_assign_op.py index 88d05bc16f3..5159517eb23 100644 --- a/test/cinn/ops/test_slice_assign_op.py +++ b/test/cinn/ops/test_slice_assign_op.py @@ -14,13 +14,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle import numpy as np -from cinn.frontend import * from cinn.common import * +from cinn.frontend import * from op_test import OpTest, OpTestTool from op_test_helper import TestCaseHelper +import paddle + def paddle_slice_assign(data, update, axes, starts, ends, strides): assert len(axes) == len(starts) == len(ends) == len(strides) diff --git a/test/cinn/ops/test_slice_op.py b/test/cinn/ops/test_slice_op.py index a302745f632..1185371fee9 100644 --- a/test/cinn/ops/test_slice_op.py +++ b/test/cinn/ops/test_slice_op.py @@ -14,12 +14,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle -from cinn.frontend import * from cinn.common import * +from cinn.frontend import * from op_test import OpTest, OpTestTool from op_test_helper import TestCaseHelper +import paddle + @OpTestTool.skip_if( not is_compiled_with_cuda(), "x86 test will be skipped due to timeout." diff --git a/test/cinn/ops/test_softmax_op.py b/test/cinn/ops/test_softmax_op.py index 6395a44d808..359e1c10da8 100644 --- a/test/cinn/ops/test_softmax_op.py +++ b/test/cinn/ops/test_softmax_op.py @@ -12,13 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle -import paddle.nn.functional as F -from cinn.frontend import * 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( not is_compiled_with_cuda(), "x86 test will be skipped due to timeout." diff --git a/test/cinn/ops/test_sort_op.py b/test/cinn/ops/test_sort_op.py index 56278986d0c..39674039d3c 100644 --- a/test/cinn/ops/test_sort_op.py +++ b/test/cinn/ops/test_sort_op.py @@ -14,12 +14,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle -from cinn.frontend import * from cinn.common import * +from cinn.frontend import * from op_test import OpTest from op_test_helper import TestCaseHelper, run_test +import paddle + class TestSortOp(OpTest): def setUp(self): diff --git a/test/cinn/ops/test_split_op.py b/test/cinn/ops/test_split_op.py index 9909664dd22..e709500c537 100755 --- a/test/cinn/ops/test_split_op.py +++ b/test/cinn/ops/test_split_op.py @@ -14,12 +14,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle -from cinn.frontend import * from cinn.common import * +from cinn.frontend import * from op_test import OpTest, OpTestTool from op_test_helper import TestCaseHelper +import paddle + @OpTestTool.skip_if( not is_compiled_with_cuda(), "x86 test will be skipped due to timeout." diff --git a/test/cinn/ops/test_sqrt_op.py b/test/cinn/ops/test_sqrt_op.py index 3ae907263dc..670034602e1 100644 --- a/test/cinn/ops/test_sqrt_op.py +++ b/test/cinn/ops/test_sqrt_op.py @@ -14,13 +14,14 @@ # 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 from op_test_helper import TestCaseHelper + import paddle -import cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_squeeze_op.py b/test/cinn/ops/test_squeeze_op.py index deee64a44db..23d8d2fc98c 100644 --- a/test/cinn/ops/test_squeeze_op.py +++ b/test/cinn/ops/test_squeeze_op.py @@ -12,12 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle -from cinn.frontend import * from cinn.common import * +from cinn.frontend import * from op_test import OpTest from op_test_helper import TestCaseHelper +import paddle + class TestSqueezeOp(OpTest): def setUp(self): diff --git a/test/cinn/ops/test_subtract_op.py b/test/cinn/ops/test_subtract_op.py index a50447ffd87..6951d941237 100644 --- a/test/cinn/ops/test_subtract_op.py +++ b/test/cinn/ops/test_subtract_op.py @@ -14,12 +14,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle -from cinn.frontend import * from cinn.common import * +from cinn.frontend import * from op_test import OpTest, OpTestTool from op_test_helper import TestCaseHelper +import paddle + @OpTestTool.skip_if( not is_compiled_with_cuda(), "x86 test will be skipped due to timeout." diff --git a/test/cinn/ops/test_sum_op.py b/test/cinn/ops/test_sum_op.py index 045b0b2099f..92b6efa2998 100644 --- a/test/cinn/ops/test_sum_op.py +++ b/test/cinn/ops/test_sum_op.py @@ -14,12 +14,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle -from cinn.frontend import * from cinn.common import * +from cinn.frontend import * from op_test import OpTest, OpTestTool from op_test_helper import TestCaseHelper +import paddle + @OpTestTool.skip_if( not is_compiled_with_cuda(), "x86 test will be skipped due to timeout." diff --git a/test/cinn/ops/test_tan_op.py b/test/cinn/ops/test_tan_op.py index 0c64edf4241..3e26841d618 100644 --- a/test/cinn/ops/test_tan_op.py +++ b/test/cinn/ops/test_tan_op.py @@ -14,13 +14,14 @@ # 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 from op_test_helper import TestCaseHelper + import paddle -import cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_tanh_op.py b/test/cinn/ops/test_tanh_op.py index 0b62958a20f..8af25cfb4f6 100644 --- a/test/cinn/ops/test_tanh_op.py +++ b/test/cinn/ops/test_tanh_op.py @@ -14,13 +14,14 @@ # 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 from op_test_helper import TestCaseHelper + import paddle -import cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_top_k_op.py b/test/cinn/ops/test_top_k_op.py index 18247e1b5db..8974ac9942d 100644 --- a/test/cinn/ops/test_top_k_op.py +++ b/test/cinn/ops/test_top_k_op.py @@ -14,12 +14,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle -from cinn.frontend import * from cinn.common import * +from cinn.frontend import * from op_test import OpTest, OpTestTool from op_test_helper import TestCaseHelper, run_test +import paddle + @OpTestTool.skip_if( not is_compiled_with_cuda(), "x86 test will be skipped due to timeout." diff --git a/test/cinn/ops/test_transpose_op.py b/test/cinn/ops/test_transpose_op.py index f46e8e8d05e..ee3f0038a25 100644 --- a/test/cinn/ops/test_transpose_op.py +++ b/test/cinn/ops/test_transpose_op.py @@ -14,12 +14,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle -from cinn.frontend import * from cinn.common import * +from cinn.frontend import * from op_test import OpTest, OpTestTool from op_test_helper import TestCaseHelper +import paddle + @OpTestTool.skip_if( not is_compiled_with_cuda(), "x86 test will be skipped due to timeout." diff --git a/test/cinn/ops/test_triangular_solve_op.py b/test/cinn/ops/test_triangular_solve_op.py index c26b793d1a6..556da4c4569 100644 --- a/test/cinn/ops/test_triangular_solve_op.py +++ b/test/cinn/ops/test_triangular_solve_op.py @@ -14,12 +14,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle -from cinn.frontend import * from cinn.common import * +from cinn.frontend import * from op_test import OpTest, OpTestTool from op_test_helper import TestCaseHelper, run_test +import paddle + @OpTestTool.skip_if( not is_compiled_with_cuda(), "triangular solve op support GPU only now." diff --git a/test/cinn/ops/test_trunc_op.py b/test/cinn/ops/test_trunc_op.py index edd5dd9397b..9e3d95d84d4 100644 --- a/test/cinn/ops/test_trunc_op.py +++ b/test/cinn/ops/test_trunc_op.py @@ -14,13 +14,14 @@ # 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 from op_test_helper import TestCaseHelper + import paddle -import cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_unary_elementwise_op.py b/test/cinn/ops/test_unary_elementwise_op.py index eee265531d7..40cda2d1def 100644 --- a/test/cinn/ops/test_unary_elementwise_op.py +++ b/test/cinn/ops/test_unary_elementwise_op.py @@ -15,12 +15,14 @@ # 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 -import cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_uniform_random_op.py b/test/cinn/ops/test_uniform_random_op.py index dfe675658a3..52245e3a358 100644 --- a/test/cinn/ops/test_uniform_random_op.py +++ b/test/cinn/ops/test_uniform_random_op.py @@ -14,12 +14,13 @@ # 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 from op_test_helper import TestCaseHelper + import paddle -import cinn -from cinn.frontend import * -from cinn.common import * @OpTestTool.skip_if( diff --git a/test/cinn/ops/test_zero_dim_tensor.py b/test/cinn/ops/test_zero_dim_tensor.py index c93a0266052..966f17febd6 100644 --- a/test/cinn/ops/test_zero_dim_tensor.py +++ b/test/cinn/ops/test_zero_dim_tensor.py @@ -15,12 +15,14 @@ # 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 -import cinn -from cinn.frontend import * -from cinn.common import * def cinn_dtype_convert(dtype_str): diff --git a/test/cinn/passes/pass_test.py b/test/cinn/passes/pass_test.py index 8f1e7330b10..8bcd4fbec29 100644 --- a/test/cinn/passes/pass_test.py +++ b/test/cinn/passes/pass_test.py @@ -12,12 +12,17 @@ # See the License for the specific language governing permissions and # limitations under the License. -from cinn.frontend import NetBuilder, Variable -from cinn.frontend import get_default_program_pass, get_default_graph_pass 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, +) + logging.basicConfig(level=os.environ.get('LOG_LEVEL', 'INFO').upper()) logger = logging.getLogger(name="pass_test") diff --git a/test/cinn/passes/test_auto_cast_pass.py b/test/cinn/passes/test_auto_cast_pass.py index da8e0d12b58..16b7f180b35 100644 --- a/test/cinn/passes/test_auto_cast_pass.py +++ b/test/cinn/passes/test_auto_cast_pass.py @@ -15,9 +15,10 @@ # limitations under the License. import unittest -from pass_test import PassTest -from cinn.frontend import * + from cinn.common import * +from cinn.frontend import * +from pass_test import PassTest class TestAutoCastPass(PassTest): diff --git a/test/cinn/passes/test_expand_zero_dim_pass.py b/test/cinn/passes/test_expand_zero_dim_pass.py index 6f149aa5cf5..4eb8dc8d1ad 100644 --- a/test/cinn/passes/test_expand_zero_dim_pass.py +++ b/test/cinn/passes/test_expand_zero_dim_pass.py @@ -15,10 +15,11 @@ # limitations under the License. import unittest -from pass_test import PassTest -from cinn.frontend import * -from cinn.common import * + import numpy as np +from cinn.common import * +from cinn.frontend import * +from pass_test import PassTest class TestExpandZeroDimPass(PassTest): diff --git a/test/cinn/passes/test_transpose_floding_input_pass.py b/test/cinn/passes/test_transpose_floding_input_pass.py index faf7ba2b740..68fa1454899 100644 --- a/test/cinn/passes/test_transpose_floding_input_pass.py +++ b/test/cinn/passes/test_transpose_floding_input_pass.py @@ -15,9 +15,10 @@ # limitations under the License. import unittest -from pass_test import PassTest -from cinn.frontend import * + from cinn.common import * +from cinn.frontend import * +from pass_test import PassTest class TestTransposeFoldingInputPass(PassTest): diff --git a/test/cinn/passes/test_transpose_floding_output_pass.py b/test/cinn/passes/test_transpose_floding_output_pass.py index bf36dd22497..4eaeace2cb4 100644 --- a/test/cinn/passes/test_transpose_floding_output_pass.py +++ b/test/cinn/passes/test_transpose_floding_output_pass.py @@ -15,9 +15,10 @@ # limitations under the License. import unittest -from pass_test import PassTest -from cinn.frontend import * + from cinn.common import * +from cinn.frontend import * +from pass_test import PassTest class TestTransposeFoldingOutputPass(PassTest): diff --git a/test/cinn/pool_utils.py b/test/cinn/pool_utils.py index ff5ab4c22f8..76c559ecf0a 100644 --- a/test/cinn/pool_utils.py +++ b/test/cinn/pool_utils.py @@ -15,9 +15,10 @@ # limitations under the License. import math -import numpy as np import sys +import numpy as np + def pool2d(np_data, attrs, dtype="float32"): pool_type = "max" diff --git a/test/cinn/test_common.py b/test/cinn/test_common.py index db2f4625631..61caba97f55 100644 --- a/test/cinn/test_common.py +++ b/test/cinn/test_common.py @@ -15,11 +15,9 @@ # limitations under the License. import unittest + import cinn -from cinn import runtime -from cinn import ir -from cinn import lang -from cinn import Target +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 e43af0bb62a..43fc0403311 100755 --- a/test/cinn/test_computation.py +++ b/test/cinn/test_computation.py @@ -14,20 +14,19 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle -import paddle.fluid as fluid -import paddle.static as static -from cinn.frontend import * -from cinn import Target -from cinn.framework import * +import sys import unittest + import cinn -from cinn import runtime -from cinn import ir -from cinn import lang -from cinn.common import * import numpy as np -import sys +from cinn import Target, ir, lang, runtime +from cinn.common import * +from cinn.framework import * +from cinn.frontend import * + +import paddle +import paddle.fluid as fluid +import paddle.static as static assert len(sys.argv) == 3 enable_gpu = sys.argv.pop() diff --git a/test/cinn/test_efficientnet.py b/test/cinn/test_efficientnet.py index 23c2b8aa177..29dc601d715 100755 --- a/test/cinn/test_efficientnet.py +++ b/test/cinn/test_efficientnet.py @@ -14,20 +14,19 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle as paddle -import paddle.fluid as fluid -from cinn.frontend import * -from cinn import Target -from cinn.framework import * +import sys +import time import unittest + import cinn -from cinn import runtime -from cinn import ir -from cinn import lang -from cinn.common import * import numpy as np -import sys -import time +from cinn import Target, ir, lang, runtime +from cinn.common import * +from cinn.framework import * +from cinn.frontend import * + +import paddle as paddle +import paddle.fluid as fluid enable_gpu = sys.argv.pop() model_dir = sys.argv.pop() diff --git a/test/cinn/test_facedet.py b/test/cinn/test_facedet.py index 0847c76a065..2a25084c277 100755 --- a/test/cinn/test_facedet.py +++ b/test/cinn/test_facedet.py @@ -14,20 +14,19 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle as paddle -import paddle.fluid as fluid -from cinn.frontend import * -from cinn import Target -from cinn.framework import * +import sys +import time import unittest + import cinn -from cinn import runtime -from cinn import ir -from cinn import lang -from cinn.common import * import numpy as np -import sys -import time +from cinn import Target, ir, lang, runtime +from cinn.common import * +from cinn.framework import * +from cinn.frontend import * + +import paddle as paddle +import paddle.fluid as fluid enable_gpu = sys.argv.pop() model_dir = sys.argv.pop() diff --git a/test/cinn/test_frontend.py b/test/cinn/test_frontend.py index f03e95404ab..7470fc348ea 100755 --- a/test/cinn/test_frontend.py +++ b/test/cinn/test_frontend.py @@ -14,19 +14,18 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle -import paddle.fluid as fluid -from cinn.frontend import * -from cinn import Target -from cinn.framework import * +import sys import unittest + import cinn -from cinn import runtime -from cinn import ir -from cinn import lang -from cinn.common import * import numpy as np -import sys +from cinn import Target, ir, lang, runtime +from cinn.common import * +from cinn.framework import * +from cinn.frontend import * + +import paddle +import paddle.fluid as fluid assert len(sys.argv) == 1 + 2 + 1 # model and enable_gpu count enable_gpu = sys.argv.pop() diff --git a/test/cinn/test_hlir_framework.py b/test/cinn/test_hlir_framework.py index 5793ea8a35e..cb200802eae 100644 --- a/test/cinn/test_hlir_framework.py +++ b/test/cinn/test_hlir_framework.py @@ -12,9 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -from cinn.framework import * import unittest + import numpy as np +from cinn.framework import * class TensorTest(unittest.TestCase): diff --git a/test/cinn/test_ir.py b/test/cinn/test_ir.py index 9f284c7323f..af14f1efbcd 100644 --- a/test/cinn/test_ir.py +++ b/test/cinn/test_ir.py @@ -15,14 +15,12 @@ # limitations under the License. import unittest + import cinn -from cinn import runtime -from cinn import ir -from cinn import lang -from cinn.optim import * -from cinn import Target +from cinn import Target, ir, lang, runtime from cinn.common import * from cinn.ir import * +from cinn.optim import * class TestIR(unittest.TestCase): diff --git a/test/cinn/test_matmul.py b/test/cinn/test_matmul.py index 3c0faeebf77..da96434ed00 100755 --- a/test/cinn/test_matmul.py +++ b/test/cinn/test_matmul.py @@ -15,13 +15,10 @@ # limitations under the License. import unittest -import numpy as np + import cinn -from cinn import runtime -from cinn import ir -from cinn import lang -from cinn import Target -from cinn import utils +import numpy as np +from cinn import Target, ir, lang, runtime, utils from cinn.poly import create_stages diff --git a/test/cinn/test_mobilenetv1.py b/test/cinn/test_mobilenetv1.py index dacbc0d3b36..4058df24b7f 100644 --- a/test/cinn/test_mobilenetv1.py +++ b/test/cinn/test_mobilenetv1.py @@ -14,20 +14,19 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle as paddle -import paddle.fluid as fluid -from cinn.frontend import * -from cinn import Target -from cinn.framework import * +import sys +import time import unittest + import cinn -from cinn import runtime -from cinn import ir -from cinn import lang -from cinn.common import * import numpy as np -import sys -import time +from cinn import Target, ir, lang, runtime +from cinn.common import * +from cinn.framework import * +from cinn.frontend import * + +import paddle as paddle +import paddle.fluid as fluid enable_gpu = sys.argv.pop() model_dir = sys.argv.pop() diff --git a/test/cinn/test_mobilenetv2.py b/test/cinn/test_mobilenetv2.py index 5feda2f15ec..f96c333a8a0 100755 --- a/test/cinn/test_mobilenetv2.py +++ b/test/cinn/test_mobilenetv2.py @@ -14,20 +14,19 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle as paddle -import paddle.fluid as fluid -from cinn.frontend import * -from cinn import Target -from cinn.framework import * +import sys +import time import unittest + import cinn -from cinn import runtime -from cinn import ir -from cinn import lang -from cinn.common import * import numpy as np -import sys -import time +from cinn import Target, ir, lang, runtime +from cinn.common import * +from cinn.framework import * +from cinn.frontend import * + +import paddle as paddle +import paddle.fluid as fluid enable_gpu = sys.argv.pop() model_dir = sys.argv.pop() diff --git a/test/cinn/test_netbuilder.py b/test/cinn/test_netbuilder.py index e4f59eb7670..526b325bf24 100755 --- a/test/cinn/test_netbuilder.py +++ b/test/cinn/test_netbuilder.py @@ -14,19 +14,18 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle -import paddle.static as static -from cinn.frontend import * -from cinn import Target -from cinn.framework import * +import sys import unittest + import cinn -from cinn import runtime -from cinn import ir -from cinn import lang -from cinn.common import * import numpy as np -import sys +from cinn import Target, ir, lang, runtime +from cinn.common import * +from cinn.framework import * +from cinn.frontend import * + +import paddle +import paddle.static as static enable_gpu = sys.argv.pop() diff --git a/test/cinn/test_op_benchmark.py b/test/cinn/test_op_benchmark.py index 653ad88fec8..ce63e4e4f69 100755 --- a/test/cinn/test_op_benchmark.py +++ b/test/cinn/test_op_benchmark.py @@ -14,19 +14,18 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle -import paddle.static as static -from cinn.frontend import * -from cinn import Target -from cinn.framework import * +import sys import unittest + import cinn -from cinn import runtime -from cinn import ir -from cinn import lang -from cinn.common import * import numpy as np -import sys +from cinn import Target, ir, lang, runtime +from cinn.common import * +from cinn.framework import * +from cinn.frontend import * + +import paddle +import paddle.static as static assert len(sys.argv) == 2 enable_gpu = sys.argv.pop() diff --git a/test/cinn/test_op_broadcast.py b/test/cinn/test_op_broadcast.py index b1abe43d460..26e8ab67bc7 100644 --- a/test/cinn/test_op_broadcast.py +++ b/test/cinn/test_op_broadcast.py @@ -14,18 +14,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest +import logging import math -import numpy as np +import unittest + import cinn -from cinn import frontend -from cinn import runtime -from cinn import lang -from cinn import framework -from cinn import ir -from cinn import common +import numpy as np +from cinn import common, framework, frontend, ir, lang, runtime from cinn.poly import create_stages -import logging from test_utils import SingleOpTester diff --git a/test/cinn/test_op_nn.py b/test/cinn/test_op_nn.py index fa6e9da6fe5..8fad122f79d 100644 --- a/test/cinn/test_op_nn.py +++ b/test/cinn/test_op_nn.py @@ -14,22 +14,19 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle as paddle -import numpy as np -import unittest +import logging import math +import unittest + import cinn -from cinn import frontend -from cinn import runtime -from cinn import lang -from cinn import framework -from cinn import ir -from cinn import common +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 -import logging from test_utils import SingleOpTester -import pool_utils -import conv2d_utils + +import paddle as paddle class OpTest_relu(SingleOpTester): diff --git a/test/cinn/test_op_transform.py b/test/cinn/test_op_transform.py index a9646f18e25..359ce379d66 100644 --- a/test/cinn/test_op_transform.py +++ b/test/cinn/test_op_transform.py @@ -14,22 +14,19 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest +import logging import math -import numpy as np +import os +import unittest + import cinn -from cinn import frontend -from cinn import runtime -from cinn import lang -from cinn import framework -from cinn import ir -from cinn import common +import numpy as np +from cinn import common, framework, frontend, ir, lang, runtime from cinn.poly import create_stages -import logging from test_utils import SingleOpTester + import paddle import paddle.static as static -import os os.environ["KMP_DUPLICATE_LIB_OK"] = "TRUE" diff --git a/test/cinn/test_packed_func.py b/test/cinn/test_packed_func.py index ae643523d20..917097a533a 100755 --- a/test/cinn/test_packed_func.py +++ b/test/cinn/test_packed_func.py @@ -15,12 +15,12 @@ # limitations under the License. import unittest -import numpy as np -import cinn -from cinn import ir -from cinn import CINNValue from math import isclose +import cinn +import numpy as np +from cinn import CINNValue, ir + class TestPackedFunc(unittest.TestCase): def setUp(self): diff --git a/test/cinn/test_paddle_model_convertor.py b/test/cinn/test_paddle_model_convertor.py index bf37e1b1b60..a408717742b 100644 --- a/test/cinn/test_paddle_model_convertor.py +++ b/test/cinn/test_paddle_model_convertor.py @@ -14,18 +14,20 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os, sys -import numpy as np +import argparse +import logging +import os +import sys import unittest -import logging, argparse - -import paddle +import numpy as np +from cinn.common import DefaultNVGPUTarget, is_compiled_with_cuda from cinn.frontend import PaddleModelConvertor -from cinn.common import is_compiled_with_cuda, DefaultNVGPUTarget from cinn.runtime import seed as cinn_seed -from ops.op_test import OpTestTool from op_mappers.op_mapper_test import OpMapperTest +from ops.op_test import OpTestTool + +import paddle logging.basicConfig(level=os.environ.get('LOG_LEVEL', 'INFO').upper()) logger = logging.getLogger(name="paddle_model_convertor") diff --git a/test/cinn/test_pe_elementwise.py b/test/cinn/test_pe_elementwise.py index b018ed33f53..a8a52fa285a 100644 --- a/test/cinn/test_pe_elementwise.py +++ b/test/cinn/test_pe_elementwise.py @@ -15,16 +15,13 @@ # limitations under the License. import unittest + import cinn import numpy as np -from cinn import runtime -from cinn import ir -from cinn.poly import create_stages -from cinn import lang -from cinn import Target -from cinn import pe -from cinn.common import * import scipy +from cinn import Target, ir, lang, pe, runtime +from cinn.common import * +from cinn.poly import create_stages from scipy import special diff --git a/test/cinn/test_pe_reduction.py b/test/cinn/test_pe_reduction.py index 78be85a9639..d8d4a8b6f01 100644 --- a/test/cinn/test_pe_reduction.py +++ b/test/cinn/test_pe_reduction.py @@ -15,13 +15,10 @@ # limitations under the License. import unittest + import cinn import numpy as np -from cinn import runtime -from cinn import ir -from cinn import lang -from cinn import Target -from cinn import pe +from cinn import Target, ir, lang, pe, runtime from cinn.common import * from cinn.poly import create_stages diff --git a/test/cinn/test_pe_transform.py b/test/cinn/test_pe_transform.py index 21987350b2f..bc78bc66dde 100644 --- a/test/cinn/test_pe_transform.py +++ b/test/cinn/test_pe_transform.py @@ -15,15 +15,12 @@ # limitations under the License. import unittest + import cinn import numpy as np -from cinn import runtime -from cinn import ir -from cinn import lang -from cinn import Target -from cinn import pe -from cinn.poly import create_stages +from cinn import Target, ir, lang, pe, runtime from cinn.common import * +from cinn.poly import create_stages class TestPETransform(unittest.TestCase): diff --git a/test/cinn/test_resnet.py b/test/cinn/test_resnet.py index b2d5cdbb228..69c3d256cc9 100755 --- a/test/cinn/test_resnet.py +++ b/test/cinn/test_resnet.py @@ -14,19 +14,18 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle as paddle -import paddle.fluid as fluid -from cinn.frontend import * -from cinn import Target -from cinn.framework import * +import sys import unittest + import cinn -from cinn import runtime -from cinn import ir -from cinn import lang -from cinn.common import * import numpy as np -import sys +from cinn import Target, ir, lang, runtime +from cinn.common import * +from cinn.framework import * +from cinn.frontend import * + +import paddle as paddle +import paddle.fluid as fluid enable_gpu = sys.argv.pop() model_dir = sys.argv.pop() diff --git a/test/cinn/test_resnet18.py b/test/cinn/test_resnet18.py index 10a553cc0c0..2d9b227ab55 100755 --- a/test/cinn/test_resnet18.py +++ b/test/cinn/test_resnet18.py @@ -14,20 +14,19 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle as paddle -import paddle.fluid as fluid -from cinn.frontend import * -from cinn import Target -from cinn.framework import * +import sys +import time import unittest + import cinn -from cinn import runtime -from cinn import ir -from cinn import lang -from cinn.common import * import numpy as np -import sys -import time +from cinn import Target, ir, lang, runtime +from cinn.common import * +from cinn.framework import * +from cinn.frontend import * + +import paddle as paddle +import paddle.fluid as fluid enable_gpu = sys.argv.pop() model_dir = sys.argv.pop() diff --git a/test/cinn/test_resnet50.py b/test/cinn/test_resnet50.py index 77ee3415384..9ecf60c22eb 100755 --- a/test/cinn/test_resnet50.py +++ b/test/cinn/test_resnet50.py @@ -14,20 +14,19 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle as paddle -import paddle.fluid as fluid -from cinn.frontend import * -from cinn import Target -from cinn.framework import * +import sys +import time import unittest + import cinn -from cinn import runtime -from cinn import ir -from cinn import lang -from cinn.common import * import numpy as np -import sys -import time +from cinn import Target, ir, lang, runtime +from cinn.common import * +from cinn.framework import * +from cinn.frontend import * + +import paddle as paddle +import paddle.fluid as fluid enable_gpu = sys.argv.pop() model_dir = sys.argv.pop() diff --git a/test/cinn/test_squeezenet.py b/test/cinn/test_squeezenet.py index 512f4e48509..65a6576915f 100644 --- a/test/cinn/test_squeezenet.py +++ b/test/cinn/test_squeezenet.py @@ -14,20 +14,19 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle as paddle -import paddle.fluid as fluid -from cinn.frontend import * -from cinn import Target -from cinn.framework import * +import sys +import time import unittest + import cinn -from cinn import runtime -from cinn import ir -from cinn import lang -from cinn.common import * import numpy as np -import sys -import time +from cinn import Target, ir, lang, runtime +from cinn.common import * +from cinn.framework import * +from cinn.frontend import * + +import paddle as paddle +import paddle.fluid as fluid enable_gpu = sys.argv.pop() model_dir = sys.argv.pop() diff --git a/test/cinn/test_utils.py b/test/cinn/test_utils.py index 2f5cd353744..f97caaab288 100755 --- a/test/cinn/test_utils.py +++ b/test/cinn/test_utils.py @@ -14,18 +14,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest +import logging import math -import numpy as np +import unittest + import cinn -from cinn import frontend -from cinn import runtime -from cinn import lang -from cinn import framework -from cinn import ir -from cinn import common +import numpy as np +from cinn import common, framework, frontend, ir, lang, runtime from cinn.poly import create_stages -import logging class SingleOpTester(unittest.TestCase): diff --git a/tools/cinn/gen_c++_tutorial.py b/tools/cinn/gen_c++_tutorial.py index 3150f693161..16132de0999 100644 --- a/tools/cinn/gen_c++_tutorial.py +++ b/tools/cinn/gen_c++_tutorial.py @@ -23,9 +23,9 @@ This script helps to extract the tutorial content from a C++ source file. # - @ROC, the code block inside a C++ multi-line string guard `ROC()ROC`, # display as a markdown code block. +import logging import sys from typing import List -import logging class Markdown(object): diff --git a/tools/cinn/paddle_benchmark/paddle_save_model.py b/tools/cinn/paddle_benchmark/paddle_save_model.py index 5ce2207c5aa..48fd5d32293 100755 --- a/tools/cinn/paddle_benchmark/paddle_save_model.py +++ b/tools/cinn/paddle_benchmark/paddle_save_model.py @@ -12,9 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os +import sys + import numpy -import sys, os import numpy as np + import paddle import paddle.fluid as fluid import paddle.static as static diff --git a/tools/cinn/paddle_benchmark/paddle_test_benchmark.py b/tools/cinn/paddle_benchmark/paddle_test_benchmark.py index b36e28a63f7..1ce6ce4e9ff 100755 --- a/tools/cinn/paddle_benchmark/paddle_test_benchmark.py +++ b/tools/cinn/paddle_benchmark/paddle_test_benchmark.py @@ -14,10 +14,11 @@ import argparse import time + import numpy as np -from paddle.fluid.core import AnalysisConfig -from paddle.fluid.core import create_paddle_predictor + import paddle.inference as paddle_infer +from paddle.fluid.core import AnalysisConfig, create_paddle_predictor def main(): diff --git a/tools/cinn/paddle_benchmark/test_paddle_ops.py b/tools/cinn/paddle_benchmark/test_paddle_ops.py index 87aa7a2a021..f35c217157c 100755 --- a/tools/cinn/paddle_benchmark/test_paddle_ops.py +++ b/tools/cinn/paddle_benchmark/test_paddle_ops.py @@ -12,15 +12,17 @@ # See the License for the specific language governing permissions and # limitations under the License. -import sys, os +import argparse +import os +import sys +import time + import numpy as np + import paddle import paddle.fluid as fluid import paddle.static as static -import time -import argparse -from paddle.fluid.core import AnalysisConfig -from paddle.fluid.core import create_paddle_predictor +from paddle.fluid.core import AnalysisConfig, create_paddle_predictor def set_config(op_name, input_shapes, enable_gpu=False): diff --git a/tools/cinn/tvm_benchmark/test_topi_default.py b/tools/cinn/tvm_benchmark/test_topi_default.py index b1109cee7ae..727b9401f83 100644 --- a/tools/cinn/tvm_benchmark/test_topi_default.py +++ b/tools/cinn/tvm_benchmark/test_topi_default.py @@ -12,14 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os +import timeit + +import numpy import tvm import tvm.testing -from tvm import te -import numpy -import timeit -from tvm.contrib import tar, ndk -import os -from tvm import topi +from tvm import te, topi +from tvm.contrib import ndk, tar dtype = ["float32", "float32", "float32", "float32"] target = "llvm" diff --git a/tools/cinn/tvm_benchmark/tvm_graph_with_single_op.py b/tools/cinn/tvm_benchmark/tvm_graph_with_single_op.py index b762cdb0444..664970bc193 100755 --- a/tools/cinn/tvm_benchmark/tvm_graph_with_single_op.py +++ b/tools/cinn/tvm_benchmark/tvm_graph_with_single_op.py @@ -15,15 +15,12 @@ import os import numpy as np - import tvm -from tvm import te -from tvm import autotvm -from tvm import relay +import tvm.contrib.graph_runtime as runtime import tvm.relay.testing -from tvm.autotvm.tuner import XGBTuner, GATuner, RandomTuner, GridSearchTuner +from tvm import autotvm, relay, te +from tvm.autotvm.tuner import GATuner, GridSearchTuner, RandomTuner, XGBTuner from tvm.contrib.utils import tempdir -import tvm.contrib.graph_runtime as runtime # To test different ops, change this single-op network. # See https://github.com/apache/incubator-tvm/blob/main/docs/langref/relay_op.rst to get the op list. -- GitLab