forked from mindspore-Ecosystem/mindspore
clean pylint warnings
This commit is contained in:
parent
5aa55302d4
commit
d7e1ab1445
|
@ -15,7 +15,6 @@
|
|||
|
||||
import os
|
||||
import numpy as np
|
||||
import pytest
|
||||
|
||||
import mindspore.common.dtype as mstype
|
||||
import mindspore.context as context
|
||||
|
@ -113,8 +112,7 @@ class ResidualBlock(nn.Cell):
|
|||
def __init__(self,
|
||||
in_channels,
|
||||
out_channels,
|
||||
stride=1,
|
||||
momentum=0.9):
|
||||
stride=1):
|
||||
super(ResidualBlock, self).__init__()
|
||||
|
||||
out_chls = out_channels // self.expansion
|
||||
|
|
|
@ -39,10 +39,10 @@ class MindDataSet(MindData):
|
|||
if self._size < self._iter_num:
|
||||
raise StopIteration
|
||||
self._iter_num += 1
|
||||
next = []
|
||||
for shape, type in zip(self._output_shapes, self._np_types):
|
||||
next.append(Tensor(np.ones(shape).astype(type)))
|
||||
return tuple(next)
|
||||
next_ = []
|
||||
for shape, type_ in zip(self._output_shapes, self._np_types):
|
||||
next_.append(Tensor(np.ones(shape).astype(type_)))
|
||||
return tuple(next_)
|
||||
|
||||
|
||||
class Net(nn.Cell):
|
||||
|
@ -53,8 +53,8 @@ class Net(nn.Cell):
|
|||
self.matmul = P.MatMul()
|
||||
self.add = P.TensorAdd()
|
||||
|
||||
def construct(self, input):
|
||||
output = self.add(self.matmul(input, self.weight), self.bias)
|
||||
def construct(self, input_):
|
||||
output = self.add(self.matmul(input_, self.weight), self.bias)
|
||||
return output
|
||||
|
||||
|
||||
|
@ -67,9 +67,9 @@ class NetFP16(nn.Cell):
|
|||
self.add = P.TensorAdd()
|
||||
self.cast = P.Cast()
|
||||
|
||||
def construct(self, input):
|
||||
def construct(self, input_):
|
||||
output = self.cast(
|
||||
self.add(self.matmul(self.cast(input, mstype.float16), self.cast(self.weight, mstype.float16)),
|
||||
self.add(self.matmul(self.cast(input_, mstype.float16), self.cast(self.weight, mstype.float16)),
|
||||
self.cast(self.bias, mstype.float16)), mstype.float32)
|
||||
return output
|
||||
|
||||
|
@ -107,5 +107,5 @@ def test_auto_parallel_flag():
|
|||
optimizer = Momentum(net.trainable_params(), learning_rate=0.1, momentum=0.9)
|
||||
model = Model(net, loss_fn=loss, optimizer=optimizer, metrics=None, loss_scale_manager=scale_manager)
|
||||
model.train(2, dataset)
|
||||
assert(model._train_network.get_flags()["auto_parallel"] == True)
|
||||
assert model._train_network.get_flags()["auto_parallel"]
|
||||
context.reset_auto_parallel_context()
|
||||
|
|
|
@ -17,9 +17,7 @@ import numpy as np
|
|||
import mindspore as ms
|
||||
import mindspore.nn as nn
|
||||
from mindspore import Tensor
|
||||
from mindspore import context
|
||||
from mindspore.common.api import _executor
|
||||
from mindspore.ops import composite as C
|
||||
from mindspore.ops import operations as P
|
||||
from tests.ut.python.ops.test_math_ops import VirtualLoss
|
||||
|
||||
|
|
Loading…
Reference in New Issue