Browse Source

!1568 Fix pylint warning for test cases of optimizer, infer, parse and pynative.

Merge pull request !1568 from seatea/fix-pylint-warning
tags/v0.5.0-beta
mindspore-ci-bot Gitee 5 years ago
parent
commit
9c858444b0
12 changed files with 11 additions and 13 deletions
  1. +1
    -1
      tests/ut/cpp/python_input/gtest_input/optimizer/ad/ad_test.py
  2. +1
    -1
      tests/ut/cpp/python_input/gtest_input/optimizer/opt_test.py
  3. +2
    -2
      tests/ut/cpp/python_input/gtest_input/pipeline/parse/parser_integrate.py
  4. +1
    -1
      tests/ut/cpp/python_input/gtest_input/session/session_test.py
  5. +1
    -1
      tests/ut/python/pipeline/infer/infer.py
  6. +1
    -1
      tests/ut/python/pipeline/infer/test_hypermap_specialize.py
  7. +1
    -1
      tests/ut/python/pipeline/parse/test_for_stmt.py
  8. +1
    -1
      tests/ut/python/pipeline/parse/test_operator.py
  9. +0
    -1
      tests/ut/python/pipeline/parse/test_parse.py
  10. +0
    -1
      tests/ut/python/pynative_mode/nn/test_activation.py
  11. +1
    -1
      tests/ut/python/pynative_mode/nn/test_cell.py
  12. +1
    -1
      tests/ut/python/pynative_mode/nn/test_container.py

+ 1
- 1
tests/ut/cpp/python_input/gtest_input/optimizer/ad/ad_test.py View File

@@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# ============================================================================ # ============================================================================
import numpy as np
from dataclasses import dataclass from dataclasses import dataclass
import numpy as np


import mindspore as ms import mindspore as ms
from mindspore.common.tensor import Tensor from mindspore.common.tensor import Tensor


+ 1
- 1
tests/ut/cpp/python_input/gtest_input/optimizer/opt_test.py View File

@@ -16,7 +16,7 @@
import numpy as np import numpy as np


from mindspore import Tensor from mindspore import Tensor
from mindspore.ops import Primitive, PrimitiveWithInfer
from mindspore.ops import Primitive
from mindspore.ops import operations as P from mindspore.ops import operations as P
from mindspore.ops.operations import _grad_ops as G from mindspore.ops.operations import _grad_ops as G




+ 2
- 2
tests/ut/cpp/python_input/gtest_input/pipeline/parse/parser_integrate.py View File

@@ -136,8 +136,8 @@ class Net(nn.Cell):
super(Net, self).__init__() super(Net, self).__init__()
self.conv = nn.Conv2d(3, 64, 3, bias_init='zeros') self.conv = nn.Conv2d(3, 64, 3, bias_init='zeros')


def construct(self, input):
return self.conv(input)
def construct(self, inputs):
return self.conv(inputs)




class TestNet(nn.Cell): class TestNet(nn.Cell):


+ 1
- 1
tests/ut/cpp/python_input/gtest_input/session/session_test.py View File

@@ -25,7 +25,7 @@ max_pool = P.MaxPoolWithArgmax(padding="same", ksize=3, strides=2)




def test_addn_cast(x, y, z): def test_addn_cast(x, y, z):
mysum = addn((x, y))
mysum = addn((x, y, z))
res = cast(mysum, ms.float16) res = cast(mysum, ms.float16)
return res return res




+ 1
- 1
tests/ut/python/pipeline/infer/infer.py View File

@@ -13,8 +13,8 @@
# limitations under the License. # limitations under the License.
# ============================================================================ # ============================================================================
""" infer """ """ infer """
import numpy as np
from argparse import ArgumentParser from argparse import ArgumentParser
import numpy as np


from mindspore import Tensor from mindspore import Tensor
from ....dataset_mock import MindData from ....dataset_mock import MindData


+ 1
- 1
tests/ut/python/pipeline/infer/test_hypermap_specialize.py View File

@@ -53,4 +53,4 @@ def test_hypermap_specialize_param():


expected_ret = (Tensor(np.full(1, 5).astype(np.int32)), Tensor(np.full(2, 5).astype(np.int32))) expected_ret = (Tensor(np.full(1, 5).astype(np.int32)), Tensor(np.full(2, 5).astype(np.int32)))
ret = hypermap_specialize_param() ret = hypermap_specialize_param()
assert (ret == (expected_ret, expected_ret))
assert ret == (expected_ret, expected_ret)

+ 1
- 1
tests/ut/python/pipeline/parse/test_for_stmt.py View File

@@ -13,8 +13,8 @@
# limitations under the License. # limitations under the License.
# ============================================================================ # ============================================================================
""" test_for_stmt """ """ test_for_stmt """
import numpy as np
from dataclasses import dataclass from dataclasses import dataclass
import numpy as np


from mindspore import Tensor, Model, context from mindspore import Tensor, Model, context
from mindspore.nn import Cell from mindspore.nn import Cell


+ 1
- 1
tests/ut/python/pipeline/parse/test_operator.py View File

@@ -163,7 +163,7 @@ def test_ops():
ret_floor = p // q + q // p ret_floor = p // q + q // p
ret = ret_pow + ret_mod + ret_floor ret = ret_pow + ret_mod + ret_floor
if self.int > self.float: if self.int > self.float:
if [1, 2, 3] != None:
if [1, 2, 3] is not None:
if self.str_a + self.str_b == "helloworld": if self.str_a + self.str_b == "helloworld":
if q == 86: if q == 86:
print("hello world") print("hello world")


+ 0
- 1
tests/ut/python/pipeline/parse/test_parse.py View File

@@ -25,7 +25,6 @@ import mindspore as ms
import mindspore.nn as nn import mindspore.nn as nn
from mindspore import Tensor from mindspore import Tensor
from mindspore.common.api import ms_function, _executor from mindspore.common.api import ms_function, _executor
from mindspore.ops.composite import core
from mindspore.ops.functional import tensor_add from mindspore.ops.functional import tensor_add
from ...ut_filter import non_graph_engine from ...ut_filter import non_graph_engine




+ 0
- 1
tests/ut/python/pynative_mode/nn/test_activation.py View File

@@ -14,7 +14,6 @@
# ============================================================================ # ============================================================================
""" test Activations """ """ test Activations """
import numpy as np import numpy as np
import pytest


import mindspore.nn as nn import mindspore.nn as nn
from mindspore import Tensor from mindspore import Tensor


+ 1
- 1
tests/ut/python/pynative_mode/nn/test_cell.py View File

@@ -305,4 +305,4 @@ def test_net_call():
net = ConvNet() net = ConvNet()
input_x = Tensor( input_x = Tensor(
np.random.randint(0, 255, [1, 3, net.image_h, net.image_w]).astype(np.float32)) np.random.randint(0, 255, [1, 3, net.image_h, net.image_w]).astype(np.float32))
output = net.construct(input_x)
net.construct(input_x)

+ 1
- 1
tests/ut/python/pynative_mode/nn/test_container.py View File

@@ -13,9 +13,9 @@
# limitations under the License. # limitations under the License.
# ============================================================================ # ============================================================================
""" test_container """ """ test_container """
from collections import OrderedDict
import numpy as np import numpy as np
import pytest import pytest
from collections import OrderedDict


import mindspore.nn as nn import mindspore.nn as nn
from mindspore import Tensor from mindspore import Tensor


Loading…
Cancel
Save