!2788 Delete shape validation in initializer()

Merge pull request !2788 from yangzhenzhang/delete-shape-validation
This commit is contained in:
mindspore-ci-bot 2020-07-01 17:13:32 +08:00 committed by Gitee
commit 31d6d30e6a
2 changed files with 1 additions and 12 deletions

View File

@ -343,10 +343,6 @@ def initializer(init, shape=None, dtype=mstype.float32):
shape = tuple(shape)
elif isinstance(shape, numbers.Number):
shape = (shape,)
try:
np.ndarray(shape)
except ValueError:
raise ValueError("Error shape={}".format(shape))
if isinstance(init, Initializer):
init.shape = init.shape if init.shape is not None else shape

View File

@ -49,13 +49,6 @@ class Net(nn.Cell):
return out
def test_shape_error():
""" for fuzz test"""
in_str = "3 22222222222222222222222222264 3 64 64 222 222 3"
with pytest.raises(ValueError):
Net(in_str)
class LeNet5(nn.Cell):
""" LeNet5 definition """
@ -98,7 +91,7 @@ class LeNet5(nn.Cell):
return x
def test_shape_error_2():
def test_shape_error():
""" for fuzz test"""
in_str = "3 6 5 6 -6 5 16 5 5 120 120 84 84 3 2"
with pytest.raises(ValueError):