From ebbccca78b1a026fc6c9ceab529fa9821383297a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cliuxiao=E2=80=9D?= Date: Tue, 26 May 2020 19:36:54 +0800 Subject: [PATCH] pylint clean --- tests/ut/python/model/test_bert_cell.py | 4 ++-- tests/ut/python/nn/optim/test_lars.py | 2 +- tests/ut/python/nn/test_container.py | 2 +- tests/ut/python/nn/test_loss.py | 2 +- tests/ut/python/nn/test_parameter.py | 1 - tests/ut/python/onnx/test_onnx.py | 6 ++---- tests/ut/python/predict/test_predict_save_model.py | 2 +- tests/ut/python/train/quant/test_quant.py | 1 - 8 files changed, 8 insertions(+), 12 deletions(-) diff --git a/tests/ut/python/model/test_bert_cell.py b/tests/ut/python/model/test_bert_cell.py index 817a75b6b49..175341767af 100644 --- a/tests/ut/python/model/test_bert_cell.py +++ b/tests/ut/python/model/test_bert_cell.py @@ -107,7 +107,7 @@ class TrainStepWrapForAdamDynamicLr(nn.Cell): class TempC2Wrap(nn.Cell): - def __init__(self, op, c1=None, c2=None, ): + def __init__(self, op, c1=None, c2=None,): super(TempC2Wrap, self).__init__() self.op = op self.c1 = c1 @@ -387,7 +387,7 @@ test_case_cell_ops = [ 'block': set_train(nn.Dense(in_channels=768, out_channels=3072, activation='gelu', - weight_init=TruncatedNormal(0.02), )), + weight_init=TruncatedNormal(0.02),)), 'desc_inputs': [[3, 768]], 'desc_bprop': [[3, 3072]]}), ('GetNextSentenceOutput', { diff --git a/tests/ut/python/nn/optim/test_lars.py b/tests/ut/python/nn/optim/test_lars.py index c34033d884b..d6fd4cd90eb 100644 --- a/tests/ut/python/nn/optim/test_lars.py +++ b/tests/ut/python/nn/optim/test_lars.py @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================ -import numpy as np from collections import Counter +import numpy as np import mindspore.nn as nn from mindspore import Tensor, Parameter diff --git a/tests/ut/python/nn/test_container.py b/tests/ut/python/nn/test_container.py index cd3e34a2fa9..c381394c26d 100644 --- a/tests/ut/python/nn/test_container.py +++ b/tests/ut/python/nn/test_container.py @@ -13,9 +13,9 @@ # limitations under the License. # ============================================================================ """ test container """ +from collections import OrderedDict import numpy as np import pytest -from collections import OrderedDict import mindspore.nn as nn from mindspore import Tensor diff --git a/tests/ut/python/nn/test_loss.py b/tests/ut/python/nn/test_loss.py index 4139e32d742..21e30068187 100644 --- a/tests/ut/python/nn/test_loss.py +++ b/tests/ut/python/nn/test_loss.py @@ -60,5 +60,5 @@ def test_SoftmaxCrossEntropyExpand(): loss = nn.SoftmaxCrossEntropyExpand() logits = Tensor(np.random.randint(0, 9, [100, 10]).astype(np.float32)) - labels = Tensor(np.random.randint(0, 9, [10, ]).astype(np.float32)) + labels = Tensor(np.random.randint(0, 9, [10,]).astype(np.float32)) _executor.compile(loss, logits, labels) diff --git a/tests/ut/python/nn/test_parameter.py b/tests/ut/python/nn/test_parameter.py index 886f855a79e..3c66e0a6dfb 100644 --- a/tests/ut/python/nn/test_parameter.py +++ b/tests/ut/python/nn/test_parameter.py @@ -54,7 +54,6 @@ def test_parameter_tuple_illegal(): def test_parameter_init_illegal(): - import numpy as np dat = np.array([[1, 2, 3], [2, 3, 4]]) tensor = Tensor(dat) data_none = None diff --git a/tests/ut/python/onnx/test_onnx.py b/tests/ut/python/onnx/test_onnx.py index a3de151ae90..ca877548de1 100644 --- a/tests/ut/python/onnx/test_onnx.py +++ b/tests/ut/python/onnx/test_onnx.py @@ -13,13 +13,11 @@ # limitations under the License. # ============================================================================ """ut for model serialize(save/load)""" -import numpy as np import os -import pytest import stat -import time +import numpy as np +import pytest -import mindspore.common.dtype as mstype import mindspore.nn as nn from mindspore import context from mindspore.common.parameter import Parameter diff --git a/tests/ut/python/predict/test_predict_save_model.py b/tests/ut/python/predict/test_predict_save_model.py index 20744eaf5ac..5764678e196 100644 --- a/tests/ut/python/predict/test_predict_save_model.py +++ b/tests/ut/python/predict/test_predict_save_model.py @@ -20,8 +20,8 @@ Usage: """ import argparse -import numpy as np import os +import numpy as np import mindspore.context as context import mindspore.nn as nn diff --git a/tests/ut/python/train/quant/test_quant.py b/tests/ut/python/train/quant/test_quant.py index e1acd0ccb82..2424b7ce7c7 100644 --- a/tests/ut/python/train/quant/test_quant.py +++ b/tests/ut/python/train/quant/test_quant.py @@ -17,7 +17,6 @@ import numpy as np from mobilenetv2_combined import MobileNetV2 import mindspore.context as context -import mindspore.ops.operations as P from mindspore import Tensor from mindspore import nn from mindspore.nn.layer import combined