forked from mindspore-Ecosystem/mindspore
Fix pylint warning for test cases of optimizer, infer, parse and
pynative.
This commit is contained in:
parent
a5161a969f
commit
7398526abc
|
@ -12,8 +12,8 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
# ============================================================================
|
||||
import numpy as np
|
||||
from dataclasses import dataclass
|
||||
import numpy as np
|
||||
|
||||
import mindspore as ms
|
||||
from mindspore.common.tensor import Tensor
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
import numpy as np
|
||||
|
||||
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.operations import _grad_ops as G
|
||||
|
||||
|
|
|
@ -136,8 +136,8 @@ class Net(nn.Cell):
|
|||
super(Net, self).__init__()
|
||||
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):
|
||||
|
|
|
@ -25,7 +25,7 @@ max_pool = P.MaxPoolWithArgmax(padding="same", ksize=3, strides=2)
|
|||
|
||||
|
||||
def test_addn_cast(x, y, z):
|
||||
mysum = addn((x, y))
|
||||
mysum = addn((x, y, z))
|
||||
res = cast(mysum, ms.float16)
|
||||
return res
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
# limitations under the License.
|
||||
# ============================================================================
|
||||
""" infer """
|
||||
import numpy as np
|
||||
from argparse import ArgumentParser
|
||||
import numpy as np
|
||||
|
||||
from mindspore import Tensor
|
||||
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)))
|
||||
ret = hypermap_specialize_param()
|
||||
assert (ret == (expected_ret, expected_ret))
|
||||
assert ret == (expected_ret, expected_ret)
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
# limitations under the License.
|
||||
# ============================================================================
|
||||
""" test_for_stmt """
|
||||
import numpy as np
|
||||
from dataclasses import dataclass
|
||||
import numpy as np
|
||||
|
||||
from mindspore import Tensor, Model, context
|
||||
from mindspore.nn import Cell
|
||||
|
|
|
@ -163,7 +163,7 @@ def test_ops():
|
|||
ret_floor = p // q + q // p
|
||||
ret = ret_pow + ret_mod + ret_floor
|
||||
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 q == 86:
|
||||
print("hello world")
|
||||
|
|
|
@ -25,7 +25,6 @@ import mindspore as ms
|
|||
import mindspore.nn as nn
|
||||
from mindspore import Tensor
|
||||
from mindspore.common.api import ms_function, _executor
|
||||
from mindspore.ops.composite import core
|
||||
from mindspore.ops.functional import tensor_add
|
||||
from ...ut_filter import non_graph_engine
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
# ============================================================================
|
||||
""" test Activations """
|
||||
import numpy as np
|
||||
import pytest
|
||||
|
||||
import mindspore.nn as nn
|
||||
from mindspore import Tensor
|
||||
|
|
|
@ -305,4 +305,4 @@ def test_net_call():
|
|||
net = ConvNet()
|
||||
input_x = Tensor(
|
||||
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.
|
||||
# ============================================================================
|
||||
""" 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
|
||||
|
|
Loading…
Reference in New Issue