Skip to content

Commit

Permalink
[CI] Apply linting rules to caffe2 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
blackkker committed Jul 7, 2022
1 parent 0d6e77d commit ecced29
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
1 change: 1 addition & 0 deletions tests/lint/pylint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ python3 -m pylint vta/python/vta --rcfile="$(dirname "$0")"/pylintrc
python3 -m pylint tests/python/unittest/test_tvmscript_type.py --rcfile="$(dirname "$0")"/pylintrc
python3 -m pylint tests/python/contrib/test_cmsisnn --rcfile="$(dirname "$0")"/pylintrc
python3 -m pylint tests/python/frontend/caffe/test_forward.py --rcfile="$(dirname "$0")"/pylintrc
python3 -m pylint tests/python/frontend/caffe2/test_forward.py --rcfile="$(dirname "$0")"/pylintrc

2 changes: 1 addition & 1 deletion tests/python/frontend/caffe/test_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -1194,4 +1194,4 @@ def test_forward_Inceptionv1():
test_forward_Mobilenetv2()
test_forward_Alexnet()
test_forward_Resnet50()
test_forward_Inceptionv1()
test_forward_Inceptionv1()
20 changes: 15 additions & 5 deletions tests/python/frontend/caffe2/test_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,22 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# pylint: disable=no-else-return
"""
Caffe2 testcases
====================
This article is a test script to test Caffe2 operator with Relay.
"""
from collections import namedtuple
import numpy as np

from caffe2.python import workspace, core
from caffe2.proto import caffe2_pb2
from model_zoo import c2_squeezenet, c2_resnet50, c2_vgg19
import tvm
from tvm import te
from tvm.contrib import graph_executor
from tvm import relay
from model_zoo import c2_squeezenet, c2_resnet50, c2_vgg19
from caffe2.python import workspace, core
from caffe2.proto import caffe2_pb2
from collections import namedtuple

import tvm.testing


Expand Down Expand Up @@ -103,6 +110,7 @@ def test_forward_vgg19():

@tvm.testing.uses_gpu
def test_elementwise_add():
"""Elewise_add"""
data_shape = (1, 16, 9, 9)
init_net = caffe2_pb2.NetDef()
init_net.name = "test_init_net"
Expand Down Expand Up @@ -146,6 +154,7 @@ def test_elementwise_add():

@tvm.testing.uses_gpu
def test_elementwise_add_with_broadcast():
"""Elewise_add_with_broadcast"""
data_shape = (1, 16, 9, 9)
init_net = caffe2_pb2.NetDef()
init_net.name = "test_init_net"
Expand Down Expand Up @@ -190,6 +199,7 @@ def test_elementwise_add_with_broadcast():

@tvm.testing.uses_gpu
def test_normalize_yuv():
"""Normalize_yuv"""
data_shape = (1, 3, 96, 96)
init_net = caffe2_pb2.NetDef()
init_net.name = "test_init_net"
Expand Down
6 changes: 3 additions & 3 deletions tests/python/frontend/tflite/test_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -1792,7 +1792,7 @@ def test_forward_shape():
r = tf.range(start, limit, delta, tf.int32, name="range")
out = tf.shape(r, out_type=tf.dtypes.int32)
compare_tflite_with_tvm(
[x for x in np.nditer(data)], # pylint: disable=unnecessary-comprehension
[x for x in np.nditer(data)], # pylint: disable=unnecessary-comprehension
["start", "limit", "delta"],
[start, limit, delta],
[out],
Expand Down Expand Up @@ -2560,9 +2560,9 @@ def _test_forward_add_n(inputs):
temp.append(tf.placeholder(shape=each.shape, dtype=each.dtype))
output = tf.add_n(temp)
compare_tflite_with_tvm(
[each for each in inputs], # pylint: disable=unnecessary-comprehension
[each for each in inputs], # pylint: disable=unnecessary-comprehension
[each.name for each in temp],
[each for each in temp], # pylint: disable=unnecessary-comprehension
[each for each in temp], # pylint: disable=unnecessary-comprehension
[output],
)

Expand Down

0 comments on commit ecced29

Please sign in to comment.