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

Merge pull request !1568 from seatea/fix-pylint-warning
pull/1568/MERGE
mindspore-ci-bot 5 years ago committed by Gitee
commit 9c858444b0

@ -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

@ -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

@ -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): def construct(self, inputs):
return self.conv(input) return self.conv(inputs)
class TestNet(nn.Cell): class TestNet(nn.Cell):

@ -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

@ -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

@ -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)

@ -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

@ -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")

@ -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

@ -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

@ -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)

@ -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