未验证 提交 88b986a6 编写于 作者: 张春乔 提交者: GitHub

[CodeStyle][CINN] ruff F401,F632,F811 in test/cinn (#55013)

上级 3cca2a87
......@@ -103,8 +103,5 @@ ignore = [
"F403",
]
"test/cinn/**" = [
"F401",
"F403",
"F632",
"F811",
]
......@@ -16,7 +16,6 @@ import os
import shutil
import unittest
import cinn
import numpy as np
from cinn.auto_schedule.cost_model import CostModel
......
......@@ -12,11 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import sys
import numpy
import numpy as np
import paddle
from paddle import fluid, static
......
......@@ -14,11 +14,7 @@
"""
A fake model with multiple FC layers to test CINN on a more complex model.
"""
import os
import sys
import numpy
import numpy as np
import paddle
from paddle import fluid, static
......
......@@ -12,11 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import sys
import numpy
import numpy as np
import paddle
from paddle import fluid, static
......
......@@ -17,18 +17,17 @@
import logging
import os
import sys
from ast import arg
from cinn.common import is_compiled_with_cuda
from cinn.framework import Scope
from cinn.frontend import NetBuilder, PaddleModelConvertor
from cinn.frontend import PaddleModelConvertor
import paddle
from paddle.fluid.layer_helper import LayerHelper
from paddle.static import Variable as PaddleVariable
sys.path.append("/work/dev_CINN/build/python/tests")
from test.cinn.ops.op_test import OpTest, OpTestTool
from test.cinn.ops.op_test import OpTest
logging.basicConfig(level=os.environ.get('LOG_LEVEL', 'INFO').upper())
logger = logging.getLogger(name="op_test")
......
......@@ -16,8 +16,7 @@
import unittest
import numpy as np
from op_mapper_test import OpMapperTest, logger
from op_mapper_test import OpMapperTest
import paddle
......
......@@ -17,9 +17,7 @@
import unittest
import numpy as np
from op_mapper_test import OpMapperTest, logger
import paddle
from op_mapper_test import OpMapperTest
class TestAssignValueOp(OpMapperTest):
......
......@@ -16,8 +16,7 @@
import unittest
import numpy as np
from op_mapper_test import OpMapperTest, logger
from op_mapper_test import OpMapperTest
import paddle
......
......@@ -16,8 +16,7 @@
import unittest
import numpy as np
from op_mapper_test import OpMapperTest, logger
from op_mapper_test import OpMapperTest
import paddle
......
......@@ -16,8 +16,7 @@
import unittest
import numpy as np
from op_mapper_test import OpMapperTest, logger
from op_mapper_test import OpMapperTest
import paddle
......
......@@ -16,8 +16,7 @@
import unittest
import numpy as np
from op_mapper_test import OpMapperTest, logger
from op_mapper_test import OpMapperTest
import paddle
......
......@@ -16,8 +16,7 @@
import unittest
import numpy as np
from op_mapper_test import OpMapperTest, logger
from op_mapper_test import OpMapperTest
import paddle
......
......@@ -16,8 +16,7 @@
import unittest
import numpy as np
from op_mapper_test import OpMapperTest, logger
from op_mapper_test import OpMapperTest
import paddle
......
......@@ -16,8 +16,7 @@
import unittest
import numpy as np
from op_mapper_test import OpMapperTest, logger
from op_mapper_test import OpMapperTest
import paddle
......
......@@ -16,8 +16,7 @@
import unittest
import numpy as np
from op_mapper_test import OpMapperTest, logger
from op_mapper_test import OpMapperTest
import paddle
......
......@@ -16,8 +16,7 @@
import unittest
import numpy as np
from op_mapper_test import OpMapperTest, logger
from op_mapper_test import OpMapperTest
import paddle
......
......@@ -17,7 +17,7 @@
import unittest
import numpy as np
from op_mapper_test import OpMapperTest, logger
from op_mapper_test import OpMapperTest
import paddle
......
......@@ -17,7 +17,7 @@
import unittest
import numpy as np
from op_mapper_test import OpMapperTest, logger
from op_mapper_test import OpMapperTest
import paddle
......
......@@ -16,8 +16,7 @@
import unittest
import numpy as np
from op_mapper_test import OpMapperTest, logger
from op_mapper_test import OpMapperTest
import paddle
......
......@@ -16,10 +16,7 @@
import unittest
import numpy as np
from op_mapper_test import OpMapperTest, logger
import paddle
from op_mapper_test import OpMapperTest
class TestGaussianRandomOp(OpMapperTest):
......
......@@ -14,11 +14,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import functools
import unittest
import numpy as np
from op_mapper_test import OpMapperTest, logger
from op_mapper_test import OpMapperTest
import paddle
......
......@@ -16,8 +16,7 @@
import unittest
import numpy as np
from op_mapper_test import OpMapperTest, logger
from op_mapper_test import OpMapperTest
import paddle
......
......@@ -16,8 +16,7 @@
import unittest
import numpy as np
from op_mapper_test import OpMapperTest, logger
from op_mapper_test import OpMapperTest
import paddle
......
......@@ -14,8 +14,7 @@
import unittest
import numpy as np
from op_mapper_test import OpMapperTest, logger
from op_mapper_test import OpMapperTest
import paddle
......
......@@ -16,8 +16,7 @@
import unittest
import numpy as np
from op_mapper_test import OpMapperTest, logger
from op_mapper_test import OpMapperTest
import paddle
......
......@@ -16,8 +16,7 @@
import unittest
import numpy as np
from op_mapper_test import OpMapperTest, logger
from op_mapper_test import OpMapperTest
import paddle
......
......@@ -14,8 +14,7 @@
import unittest
import numpy as np
from op_mapper_test import OpMapperTest, logger
from op_mapper_test import OpMapperTest
import paddle
......
......@@ -16,8 +16,7 @@
import unittest
import numpy as np
from op_mapper_test import OpMapperTest, logger
from op_mapper_test import OpMapperTest
import paddle
......
......@@ -16,10 +16,7 @@
import unittest
import numpy as np
from op_mapper_test import OpMapperTest, logger
import paddle
from op_mapper_test import OpMapperTest
class TestRandIntOp(OpMapperTest):
......
......@@ -16,8 +16,7 @@
import unittest
import numpy as np
from op_mapper_test import OpMapperTest, logger
from op_mapper_test import OpMapperTest
import paddle
......
......@@ -17,7 +17,7 @@
import unittest
import numpy as np
from op_mapper_test import OpMapperTest, logger
from op_mapper_test import OpMapperTest
import paddle
......
......@@ -16,8 +16,7 @@
import unittest
import numpy as np
from op_mapper_test import OpMapperTest, logger
from op_mapper_test import OpMapperTest
import paddle
......
......@@ -17,7 +17,7 @@
import unittest
import numpy as np
from op_mapper_test import OpMapperTest, logger
from op_mapper_test import OpMapperTest
import paddle
......
......@@ -16,8 +16,7 @@
import unittest
import numpy as np
from op_mapper_test import OpMapperTest, logger
from op_mapper_test import OpMapperTest
import paddle
......
......@@ -16,8 +16,7 @@
import unittest
import numpy as np
from op_mapper_test import OpMapperTest, logger
from op_mapper_test import OpMapperTest
import paddle
......
......@@ -16,8 +16,7 @@
import unittest
import numpy as np
from op_mapper_test import OpMapperTest, logger
from op_mapper_test import OpMapperTest
import paddle
......
......@@ -16,8 +16,7 @@
import unittest
import numpy as np
from op_mapper_test import OpMapperTest, logger
from op_mapper_test import OpMapperTest
import paddle
......
......@@ -17,7 +17,7 @@
import unittest
import numpy as np
from op_mapper_test import OpMapperTest, logger
from op_mapper_test import OpMapperTest
import paddle
......
......@@ -16,8 +16,7 @@
import unittest
import numpy as np
from op_mapper_test import OpMapperTest, logger
from op_mapper_test import OpMapperTest
import paddle
......
......@@ -17,7 +17,7 @@
import unittest
import numpy as np
from op_mapper_test import OpMapperTest, logger
from op_mapper_test import OpMapperTest
import paddle
......
......@@ -16,10 +16,7 @@
import unittest
import numpy as np
from op_mapper_test import OpMapperTest, logger
import paddle
from op_mapper_test import OpMapperTest
class TestUniformRandomOp(OpMapperTest):
......
......@@ -16,8 +16,7 @@
import unittest
import numpy as np
from op_mapper_test import OpMapperTest, logger
from op_mapper_test import OpMapperTest
import paddle
......
......@@ -16,10 +16,8 @@ import logging
import os
import struct
import unittest
from contextlib import contextmanager
import numpy as np
from cinn import Target
from cinn.common import *
from cinn.frontend import *
from cinn.runtime import seed as cinn_seed
......
......@@ -14,7 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
from cinn.common import *
from cinn.frontend import *
......
......@@ -12,10 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
from op_test import OpTest, OpTestTool
......
......@@ -12,10 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
from op_test import OpTest, OpTestTool
......
......@@ -14,8 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
from op_test import OpTest, OpTestTool
......
......@@ -12,10 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
from op_test import OpTest, OpTestTool
......
......@@ -12,10 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
from op_test import OpTest, OpTestTool
......
......@@ -12,10 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
from op_test import OpTest, OpTestTool
......
......@@ -14,11 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
import unittest
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
from op_test import OpTest, OpTestTool
......
......@@ -16,7 +16,6 @@
import unittest
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
......
......@@ -15,7 +15,6 @@
import unittest
from struct import pack, unpack
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
......
......@@ -14,14 +14,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
import unittest
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
from op_test import OpTest, OpTestTool
from op_test import OpTest
import paddle
......
......@@ -14,10 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
from op_test import OpTest, OpTestTool
......
......@@ -13,10 +13,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
from cinn.runtime import *
......
......@@ -14,8 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
from op_test import OpTest, OpTestTool
......
......@@ -14,8 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
from op_test import OpTest, OpTestTool
......
......@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import cinn
from cinn.common import *
from cinn.frontend import *
from op_test import OpTest, OpTestTool
......
......@@ -45,7 +45,7 @@ class TestDivOp(OpTest):
)
# paddle.divide does not support zero division
if self.case["y_dtype"] is "int32" or self.case["y_dtype"] is "int64":
if self.case["y_dtype"] == "int32" or self.case["y_dtype"] == "int64":
self.y_np[self.y_np == 0] = 1
def build_paddle_program(self, target):
......
......@@ -12,10 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
from op_test import OpTest, OpTestTool
......@@ -40,9 +37,9 @@ class TestDropoutInferOp(OpTest):
self.x_np = self.random(
shape=self.case["x_shape"], dtype=self.case["x_dtype"]
)
if self.case["mode"] is 'upscale_in_train':
if self.case["mode"] == 'upscale_in_train':
self.case["cinn_mode"] = 'upscale_in_train'
elif self.case["mode"] is 'downscale_in_infer':
elif self.case["mode"] == 'downscale_in_infer':
self.case["cinn_mode"] = 'downgrade_in_infer'
else:
raise f"Unknown mode for dropout_infer: {self.case['mode']}"
......
......@@ -14,8 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
from op_test import OpTest, OpTestTool
......
......@@ -14,8 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
from op_test import OpTest, OpTestTool
......
......@@ -14,17 +14,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
from op_test import OpTest, OpTestTool
from op_test_helper import TestCaseHelper
import paddle
import paddle.nn.functional as F
@OpTestTool.skip_if(
......
......@@ -14,8 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
from op_test import OpTest, OpTestTool
......
......@@ -19,7 +19,6 @@ import os
import unittest
from itertools import product
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
......
......@@ -16,10 +16,7 @@
import logging
import os
import unittest
from itertools import product
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
......
......@@ -14,7 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import cinn
from cinn.common import *
from cinn.frontend import *
from op_test import OpTest, OpTestTool
......
......@@ -14,10 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
from op_test import OpTest, OpTestTool
......
......@@ -14,7 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
from cinn.common import *
from cinn.frontend import *
......
......@@ -14,7 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
import numpy as np
from cinn.common import *
......
......@@ -14,7 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
import numpy as np
from cinn.common import *
......
......@@ -14,7 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
import numpy as np
from cinn.common import *
......
......@@ -14,7 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
......
......@@ -12,9 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
......
......@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import cinn
from cinn.common import *
from cinn.frontend import *
from op_test import OpTest
......
......@@ -12,9 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
......
......@@ -12,10 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
from op_test import OpTest, OpTestTool
......
......@@ -12,9 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
......
......@@ -14,7 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
......
......@@ -12,9 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
......
......@@ -14,7 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import cinn
from cinn.common import *
from cinn.frontend import *
from op_test import OpTest, OpTestTool
......
......@@ -14,17 +14,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
from op_test import OpTest, OpTestTool
from op_test_helper import TestCaseHelper
import paddle
import paddle.nn.functional as F
@OpTestTool.skip_if(
......
......@@ -14,10 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
from op_test import OpTest, OpTestTool
......
......@@ -14,8 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
from op_test import OpTest, OpTestTool
......
......@@ -14,10 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
from op_test import OpTest, OpTestTool
......
......@@ -14,7 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
......
......@@ -15,10 +15,7 @@
# limitations under the License.
import unittest
from random import seed
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
from op_test import OpTest, OpTestTool
......
......@@ -12,13 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
from op_test import OpTest, OpTestTool
from op_test import OpTest
from op_test_helper import TestCaseHelper
import paddle
......
......@@ -16,7 +16,6 @@
import unittest
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
......
......@@ -12,10 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
from op_test import OpTest, OpTestTool
......
......@@ -12,10 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
from op_test import OpTest, OpTestTool
......
......@@ -14,7 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
......
......@@ -14,16 +14,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
from op_test import OpTest, OpTestTool
import paddle
from paddle.vision.transforms import functional as F
# paddle resize is based on cv2 module
# This test requires cv2 module (pip3.6 install opencv_python==3.2.0.7)
......
......@@ -12,9 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
......
......@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import cinn
from cinn.common import *
from cinn.frontend import *
from op_test import OpTest, OpTestTool
......
......@@ -14,8 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
from op_test import OpTest, OpTestTool
......
......@@ -12,10 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
from op_test import OpTest, OpTestTool
......
......@@ -14,8 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import cinn
import numpy as np
from cinn.common import *
from cinn.frontend import *
from op_test import OpTest, OpTestTool
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册