diff --git a/pyproject.toml b/pyproject.toml index bb6f547bde6e86d87262090aa7ff93ad7524eca4..5105f4bddf3308483573d87067987b142cdaf317 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -107,12 +107,7 @@ ignore = [ "F403", "F632", "F811", - "PLR0402", - "PLC0414", - "PLE1205", ] "tools/cinn/**" = [ "F401", - "PLR0402", - ] diff --git a/test/cinn/conv2d_utils.py b/test/cinn/conv2d_utils.py index 9a31e290fe502ad213294adc642309a77f0ab3c1..aaf9b919d58f2a67508b13399784d86daea1ef77 100644 --- a/test/cinn/conv2d_utils.py +++ b/test/cinn/conv2d_utils.py @@ -17,7 +17,7 @@ import numpy as np import paddle -import paddle.static as static +from paddle import static 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 0581c1cfdf94b0c8795348fc204e8f75756e4645..0452f41a16c6bf48d97599d91968362a14a5b7bb 100644 --- a/test/cinn/fake_model/naive_mul.py +++ b/test/cinn/fake_model/naive_mul.py @@ -19,8 +19,7 @@ import numpy import numpy as np import paddle -import paddle.fluid as fluid -import paddle.static as static +from paddle import fluid, static size = 30 paddle.enable_static() diff --git a/test/cinn/fake_model/naive_multi_fc.py b/test/cinn/fake_model/naive_multi_fc.py index 996bfcf81fa6c8acbe12e4fb561f4087009906eb..7d7995bbb256d964f70c101d10450e7a77a38d96 100644 --- a/test/cinn/fake_model/naive_multi_fc.py +++ b/test/cinn/fake_model/naive_multi_fc.py @@ -21,8 +21,7 @@ import numpy import numpy as np import paddle -import paddle.fluid as fluid -import paddle.static as static +from paddle import fluid, static size = 64 num_layers = 6 diff --git a/test/cinn/fake_model/resnet_model.py b/test/cinn/fake_model/resnet_model.py index 12d784f528397643788cb0f72c418212a7a21633..aa18fa493610604aad02dd38d7052467eb3e18ec 100644 --- a/test/cinn/fake_model/resnet_model.py +++ b/test/cinn/fake_model/resnet_model.py @@ -19,8 +19,7 @@ import numpy import numpy as np import paddle -import paddle.fluid as fluid -import paddle.static as static +from paddle import fluid, static paddle.enable_static() diff --git a/test/cinn/op_mappers/op_mapper_test.py b/test/cinn/op_mappers/op_mapper_test.py index c251afb775fc046c71b04b0e3ff5060fc269465b..978fc132dc652932ab478c75c9ccd92da95bfbc8 100644 --- a/test/cinn/op_mappers/op_mapper_test.py +++ b/test/cinn/op_mappers/op_mapper_test.py @@ -308,7 +308,7 @@ class OpMapperTest(OpTest): if results[i] is not None and len(results[i].shape) == 0: results[i] = results[i].reshape(1) - logger.debug(msg="Paddle result:") + logger.debug("Paddle result:") self.paddle_outputs = self.__remove_skip_outputs(results) def build_cinn_program(self, target): @@ -398,7 +398,7 @@ class OpMapperTest(OpTest): scope=scope, ) - logger.debug(msg="CINN result:") + logger.debug("CINN result:") self.cinn_outputs = self.__remove_skip_outputs(results) @staticmethod diff --git a/test/cinn/ops/test_depthwise_conv2d_op.py b/test/cinn/ops/test_depthwise_conv2d_op.py index 037719163464ed6a6925f08f6294cd1a87a3de0d..2819ed30fa5fe047b0bef7dd4cc0fd56d4dfd75d 100644 --- a/test/cinn/ops/test_depthwise_conv2d_op.py +++ b/test/cinn/ops/test_depthwise_conv2d_op.py @@ -19,7 +19,7 @@ from op_test import OpTest, OpTestTool from op_test_helper import TestCaseHelper import paddle -import paddle.nn as nn +from paddle import nn @OpTestTool.skip_if( diff --git a/test/cinn/test_computation.py b/test/cinn/test_computation.py index 945ad417e2ba6960f522aa3e7f0cc0b8d07fbecf..7081749021ce5d0789be328c10426044f6622075 100755 --- a/test/cinn/test_computation.py +++ b/test/cinn/test_computation.py @@ -25,8 +25,7 @@ from cinn.framework import * from cinn.frontend import * import paddle -import paddle.fluid as fluid -import paddle.static as static +from paddle import fluid, 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 e7e0c4ffb063df97399c4f7d31076bc5baa8e16b..0b277ef760bb69c52faf496390c314b90768dc3f 100755 --- a/test/cinn/test_efficientnet.py +++ b/test/cinn/test_efficientnet.py @@ -25,8 +25,8 @@ from cinn.common import * from cinn.framework import * from cinn.frontend import * -import paddle as paddle -import paddle.fluid as fluid +import paddle +from paddle import 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 0afef60b003ef2cfc2acd1296a8704d4985d4d5e..31b7e18c5e23392a272eef80b185cdeceddb5a96 100755 --- a/test/cinn/test_facedet.py +++ b/test/cinn/test_facedet.py @@ -25,8 +25,8 @@ from cinn.common import * from cinn.framework import * from cinn.frontend import * -import paddle as paddle -import paddle.fluid as fluid +import paddle +from paddle import 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 257da984708a3dff58671e904da38e304ae86338..52196a48abc6ccd955549447426df5b05a44bc8f 100755 --- a/test/cinn/test_frontend.py +++ b/test/cinn/test_frontend.py @@ -25,7 +25,7 @@ from cinn.framework import * from cinn.frontend import * import paddle -import paddle.fluid as fluid +from paddle import fluid assert len(sys.argv) == 1 + 2 + 1 # model and enable_gpu count enable_gpu = sys.argv.pop() diff --git a/test/cinn/test_mobilenetv1.py b/test/cinn/test_mobilenetv1.py index e6cf251bd19eabb432f95aed29c9e57fec7c8249..fc49d51efb94f2e403f374daa28f5c2bc718e701 100644 --- a/test/cinn/test_mobilenetv1.py +++ b/test/cinn/test_mobilenetv1.py @@ -25,8 +25,8 @@ from cinn.common import * from cinn.framework import * from cinn.frontend import * -import paddle as paddle -import paddle.fluid as fluid +import paddle +from paddle import 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 6ca646823ea58aaca016d7020c22f26d4b0cb19a..045c63ee7ab7c7968ebe9eb15f6905ebb1d14e7b 100755 --- a/test/cinn/test_mobilenetv2.py +++ b/test/cinn/test_mobilenetv2.py @@ -25,8 +25,8 @@ from cinn.common import * from cinn.framework import * from cinn.frontend import * -import paddle as paddle -import paddle.fluid as fluid +import paddle +from paddle import 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 8e1787824ac0cafbf56c2c31a65904c8dfe76db0..3da2de3c6b3be1f16435c2b27383ad22e5ccfc5d 100755 --- a/test/cinn/test_netbuilder.py +++ b/test/cinn/test_netbuilder.py @@ -25,7 +25,7 @@ from cinn.framework import * from cinn.frontend import * import paddle -import paddle.static as static +from paddle import static enable_gpu = sys.argv.pop() diff --git a/test/cinn/test_op_benchmark.py b/test/cinn/test_op_benchmark.py index 119ca6af153ad90d59853f2cbb7317e45af385a5..7ab0806d87e6bf216c04521967b50fb33323ae58 100755 --- a/test/cinn/test_op_benchmark.py +++ b/test/cinn/test_op_benchmark.py @@ -25,7 +25,7 @@ from cinn.framework import * from cinn.frontend import * import paddle -import paddle.static as static +from paddle import static assert len(sys.argv) == 2 enable_gpu = sys.argv.pop() diff --git a/test/cinn/test_op_nn.py b/test/cinn/test_op_nn.py index 8fad122f79db799806239d35170fd1983023363d..9535e16b647202fd0674a26053a7580694ebde2d 100644 --- a/test/cinn/test_op_nn.py +++ b/test/cinn/test_op_nn.py @@ -26,7 +26,7 @@ from cinn import common, framework, frontend, ir, lang, runtime from cinn.poly import create_stages from test_utils import SingleOpTester -import paddle as paddle +import paddle class OpTest_relu(SingleOpTester): diff --git a/test/cinn/test_op_transform.py b/test/cinn/test_op_transform.py index 359ce379d6627ddfde5850caa7beaa8cb73c3855..2f4958a22bbe66624cb2851dd357230c40112ab2 100644 --- a/test/cinn/test_op_transform.py +++ b/test/cinn/test_op_transform.py @@ -26,7 +26,7 @@ from cinn.poly import create_stages from test_utils import SingleOpTester import paddle -import paddle.static as static +from paddle import static os.environ["KMP_DUPLICATE_LIB_OK"] = "TRUE" diff --git a/test/cinn/test_resnet.py b/test/cinn/test_resnet.py index 3b9b7f1b88e81c76f9f50eeba800003ea4e4cf5a..556436cae33dc013bdb6e63f7246a84b918e2c28 100755 --- a/test/cinn/test_resnet.py +++ b/test/cinn/test_resnet.py @@ -24,8 +24,8 @@ from cinn.common import * from cinn.framework import * from cinn.frontend import * -import paddle as paddle -import paddle.fluid as fluid +import paddle +from paddle import 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 9bb0c210a32d5a5baf2c3ec2bf92dd762579ffcb..453aece0159bf1735e7f9324adb7d2a3bb32823d 100755 --- a/test/cinn/test_resnet18.py +++ b/test/cinn/test_resnet18.py @@ -25,8 +25,8 @@ from cinn.common import * from cinn.framework import * from cinn.frontend import * -import paddle as paddle -import paddle.fluid as fluid +import paddle +from paddle import 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 554553d62d6f02e7a5560a764a9e8ceffb466a4c..1046f85984e64ee075c099805ef4b0b070338762 100755 --- a/test/cinn/test_resnet50.py +++ b/test/cinn/test_resnet50.py @@ -25,8 +25,8 @@ from cinn.common import * from cinn.framework import * from cinn.frontend import * -import paddle as paddle -import paddle.fluid as fluid +import paddle +from paddle import 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 3983716036f96fb8fa13ce376e7a16e5a3954b4b..b85a72d2e1245690894ad44973fd914d34322309 100644 --- a/test/cinn/test_squeezenet.py +++ b/test/cinn/test_squeezenet.py @@ -25,8 +25,8 @@ from cinn.common import * from cinn.framework import * from cinn.frontend import * -import paddle as paddle -import paddle.fluid as fluid +import paddle +from paddle import fluid enable_gpu = sys.argv.pop() model_dir = sys.argv.pop() diff --git a/tools/cinn/paddle_benchmark/paddle_save_model.py b/tools/cinn/paddle_benchmark/paddle_save_model.py index 48fd5d32293f3c1c7538177b95e8ebc56b888d0a..cac82ae1db346ec19ffda2536fb5bc18e6ef307c 100755 --- a/tools/cinn/paddle_benchmark/paddle_save_model.py +++ b/tools/cinn/paddle_benchmark/paddle_save_model.py @@ -19,8 +19,7 @@ import numpy import numpy as np import paddle -import paddle.fluid as fluid -import paddle.static as static +from paddle import fluid, static # For paddlepaddle version >=2.0rc, we need to set paddle.enable_static() paddle.enable_static() diff --git a/tools/cinn/paddle_benchmark/test_paddle_ops.py b/tools/cinn/paddle_benchmark/test_paddle_ops.py index f35c217157c1740c24286c716b2cbf46ed3e81a1..391b3eb013cd771ff72b745464274094ecf6f3cb 100755 --- a/tools/cinn/paddle_benchmark/test_paddle_ops.py +++ b/tools/cinn/paddle_benchmark/test_paddle_ops.py @@ -20,8 +20,7 @@ import time import numpy as np import paddle -import paddle.fluid as fluid -import paddle.static as static +from paddle import fluid, static from paddle.fluid.core import AnalysisConfig, create_paddle_predictor