Skip to content

Commit

Permalink
Update pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
yongwww committed Apr 26, 2023
1 parent 02380f3 commit 45fe044
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 40 deletions.
1 change: 1 addition & 0 deletions tests/lint/pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ disable=
raise-missing-from,
similarities,
star-args,
superfluous-parens,
super-with-arguments,
suppressed-message,
too-many-lines,
Expand Down
4 changes: 2 additions & 2 deletions tests/python/contrib/test_hexagon/test_benchmark_maxpool2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,13 +328,13 @@ def test_maxpool2d_nhwc(

except bu.NumericalAccuracyException as exception:
print()
print(f"FAIL: Numerical accuracy error. See log file.")
print("FAIL: Numerical accuracy error. See log file.")

log_file.write("\n")
log_file.write(f"FAIL: {exception}\n")

self.benchmark_table.record_fail(
**keys_dict, comments=f"Numerical accuracy error. See log file."
**keys_dict, comments="Numerical accuracy error. See log file."
)

except bu.UnsupportedException as exception:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import math
import struct
import numpy as np
import tvm.topi.hexagon.utils as utils
from tvm.topi.hexagon import utils


class TestFixedPointConversion:
Expand Down
2 changes: 1 addition & 1 deletion tests/python/contrib/test_hexagon/test_vtcm_bandwidth.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
"""Test theoretical bandwith for data transfers to VTCM for different strategies."""

import numpy as np
import pytest

import tvm
import pytest
from tvm.script import tir as T
from tvm.tir.tensor_intrin.hexagon import DMA_READ_128_i8

Expand Down
1 change: 1 addition & 0 deletions tests/python/contrib/test_hexagon/topi/test_resize2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# pylint: disable=unused-argument
"""Resize 2D tesst.
"""
import numpy as np
Expand Down
2 changes: 1 addition & 1 deletion tests/python/frontend/caffe2/test_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
# specific language governing permissions and limitations
# under the License.
"""Test graph equality of caffe2 models."""
from model_zoo import c2_squeezenet, relay_squeezenet
import tvm
from tvm import relay
from tvm.relay import transform
from model_zoo import c2_squeezenet, relay_squeezenet


def compare_graph(lhs_mod, rhs_mod):
Expand Down
11 changes: 5 additions & 6 deletions tests/python/frontend/coreml/test_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,18 @@
from enum import Enum
import tempfile
import numpy as np
import model_zoo
import coremltools as cm
from coremltools.models.neural_network import NeuralNetworkBuilder
from coremltools.models import datatypes
from tensorflow import keras

import tvm
import tvm.topi.testing
import tvm.testing
from tvm.contrib import graph_executor
from tvm.topi.testing import conv2d_nchw_python
from tvm import relay
import model_zoo

import coremltools as cm
from coremltools.models.neural_network import NeuralNetworkBuilder
from coremltools.models import datatypes
from tensorflow import keras


def get_tvm_output(
Expand Down
9 changes: 5 additions & 4 deletions tests/python/frontend/keras/test_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
# under the License.
"""Unit tests for various models and operators"""
import numpy as np
import tvm
from tvm import relay
from tvm.contrib import graph_executor
import tvm.testing

try:
import tensorflow.compat.v1 as tf
Expand All @@ -31,6 +27,11 @@
# prevent Keras from using up all gpu memory
import keras

import tvm
from tvm import relay
from tvm.contrib import graph_executor
import tvm.testing

if tf.executing_eagerly():
GPUS = tf.config.experimental.list_physical_devices("GPU")
for gpu in GPUS:
Expand Down
3 changes: 1 addition & 2 deletions tests/python/frontend/oneflow/test_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@
import os

import numpy as np
import oneflow as flow
import tvm
import tvm.testing
import tvm.topi.testing
from tvm import relay

import oneflow as flow

MODEL_HOME = "test_model"


Expand Down
9 changes: 4 additions & 5 deletions tests/python/frontend/oneflow/test_vision_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,17 @@
import os

import numpy as np
import tvm
import tvm.testing
import tvm.topi.testing
from tvm import relay

import oneflow as flow
from flowvision.models.alexnet import alexnet
from flowvision.models.squeezenet import squeezenet1_0
from flowvision.models.shufflenet_v2 import shufflenet_v2_x0_5
from flowvision.models.mobilenet import mobilenet_v2
from flowvision.models.ghostnet import ghostnet
from flowvision.models.vision_transformer import vit_base_patch16_224
import tvm
import tvm.testing
import tvm.topi.testing
from tvm import relay

MODEL_HOME = "test_model"

Expand Down
23 changes: 12 additions & 11 deletions tests/python/frontend/tensorflow/test_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# pylint: disable=import-self, invalid-name, unused-argument
# pylint: disable=import-self, invalid-name, unused-argument, ungrouped-imports, wrong-import-order
"""
Tensorflow testcases
====================
Expand All @@ -31,16 +31,6 @@
import pytest

from PIL import Image
from tvm import relay, ir
from tvm.runtime.vm import VirtualMachine
from tvm.relay.frontend.tensorflow import from_tensorflow
from tvm.contrib import graph_executor
from tvm.contrib import utils
from relay.utils.tag_span import _set_span, _create_span, _verify_structural_equal_with_span

import tvm
import tvm.relay.testing.tf as tf_testing
import tvm.testing

from tensorflow.python.framework import constant_op
from tensorflow.python.framework import graph_util
Expand All @@ -64,6 +54,17 @@
except ImportError:
import tensorflow as tf

import tvm
from tvm import relay, ir
from tvm.runtime.vm import VirtualMachine
from tvm.relay.frontend.tensorflow import from_tensorflow
from tvm.contrib import graph_executor
from tvm.contrib import utils
import tvm.testing
import tvm.relay.testing.tf as tf_testing
from relay.utils.tag_span import _set_span, _create_span, _verify_structural_equal_with_span


# Only allow TF to run on half the GPU RAM to save the other half
# For TVM
gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.5)
Expand Down
14 changes: 7 additions & 7 deletions tests/python/frontend/tflite/test_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,7 @@

from PIL import Image

import tvm
import tvm.relay.testing.tf as tf_testing
from tvm.contrib.download import download_testdata
from tvm import relay, ir
from tvm.contrib import graph_executor
from tflite.BuiltinOperator import BuiltinOperator
from relay.utils.tag_span import _set_span, _create_span, _verify_structural_equal_with_span


try:
import tensorflow.compat.v1 as tf
Expand Down Expand Up @@ -68,6 +61,13 @@
except ImportError:
from tensorflow.contrib import lite as interpreter_wrapper

import tvm
import tvm.relay.testing.tf as tf_testing
from tvm.contrib.download import download_testdata
from tvm import relay, ir
from tvm.contrib import graph_executor
from relay.utils.tag_span import _set_span, _create_span, _verify_structural_equal_with_span


#######################################################################
# Generic run functions for TVM & TFLite
Expand Down

0 comments on commit 45fe044

Please sign in to comment.