提交 aefca7b7 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!4968 Fix some errors in API about ops and validator of input.

Merge pull request !4968 from liuxiao93/fix-some-bug
...@@ -70,7 +70,8 @@ class _Conv(Cell): ...@@ -70,7 +70,8 @@ class _Conv(Cell):
kernel_size[0] < 1 or kernel_size[1] < 1: kernel_size[0] < 1 or kernel_size[1] < 1:
raise ValueError("Attr 'kernel_size' of 'Conv2D' Op passed " raise ValueError("Attr 'kernel_size' of 'Conv2D' Op passed "
+ str(self.kernel_size) + ", should be a int or tuple and equal to or greater than 1.") + str(self.kernel_size) + ", should be a int or tuple and equal to or greater than 1.")
if (not isinstance(stride[0], int)) or (not isinstance(stride[1], int)) or stride[0] < 1 or stride[1] < 1: if (not isinstance(stride[0], int)) or (not isinstance(stride[1], int)) or \
isinstance(stride[0], bool) or isinstance(stride[1], bool) or stride[0] < 1 or stride[1] < 1:
raise ValueError("Attr 'stride' of 'Conv2D' Op passed " raise ValueError("Attr 'stride' of 'Conv2D' Op passed "
+ str(self.stride) + ", should be a int or tuple and equal to or greater than 1.") + str(self.stride) + ", should be a int or tuple and equal to or greater than 1.")
if (not isinstance(dilation[0], int)) or (not isinstance(dilation[1], int)) or \ if (not isinstance(dilation[0], int)) or (not isinstance(dilation[1], int)) or \
......
...@@ -786,7 +786,7 @@ class AddN(PrimitiveWithInfer): ...@@ -786,7 +786,7 @@ class AddN(PrimitiveWithInfer):
>>> input_x = Tensor(np.array([1, 2, 3]), mindspore.float32) >>> input_x = Tensor(np.array([1, 2, 3]), mindspore.float32)
>>> input_y = Tensor(np.array([4, 5, 6]), mindspore.float32) >>> input_y = Tensor(np.array([4, 5, 6]), mindspore.float32)
>>> net(input_x, input_y, input_x, input_y) >>> net(input_x, input_y, input_x, input_y)
Tensor([10, 14, 18], shape=(3,), dtype=mindspore.int32) [10.0, 14.0, 18.0]
""" """
@prim_attr_register @prim_attr_register
...@@ -2064,9 +2064,9 @@ class Xlogy(_MathBinaryOp): ...@@ -2064,9 +2064,9 @@ class Xlogy(_MathBinaryOp):
Examples: Examples:
>>> input_x = Tensor(np.array([-5, 0, 4]), mindspore.float32) >>> input_x = Tensor(np.array([-5, 0, 4]), mindspore.float32)
>>> input_y = Tensor(np.array([2, 2, 2]), mindspore.float32) >>> input_y = Tensor(np.array([2, 2, 2]), mindspore.float32)
>>> xlogy = P.Xlogy() >>> xlogy = P.Xlogy()
>>> Xlogy(input_x, input_y) >>> xlogy(input_x, input_y)
[-3.465736, 0.0, 2.7725887] [-3.465736, 0.0, 2.7725887]
""" """
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册