Browse Source

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

Merge pull request !4968 from liuxiao93/fix-some-bug
tags/v0.7.0-beta
mindspore-ci-bot Gitee 5 years ago
parent
commit
aefca7b782
2 changed files with 5 additions and 4 deletions
  1. +2
    -1
      mindspore/nn/layer/conv.py
  2. +3
    -3
      mindspore/ops/operations/math_ops.py

+ 2
- 1
mindspore/nn/layer/conv.py View File

@@ -70,7 +70,8 @@ class _Conv(Cell):
kernel_size[0] < 1 or kernel_size[1] < 1:
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.")
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 "
+ 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 \


+ 3
- 3
mindspore/ops/operations/math_ops.py View File

@@ -786,7 +786,7 @@ class AddN(PrimitiveWithInfer):
>>> input_x = Tensor(np.array([1, 2, 3]), mindspore.float32)
>>> input_y = Tensor(np.array([4, 5, 6]), mindspore.float32)
>>> 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
@@ -2064,9 +2064,9 @@ class Xlogy(_MathBinaryOp):

Examples:
>>> 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(input_x, input_y)
>>> xlogy(input_x, input_y)
[-3.465736, 0.0, 2.7725887]
"""



Loading…
Cancel
Save