Browse Source

!8587 fix example error.

From: @liangchenghui
Reviewed-by: @kingxian,@c_34
Signed-off-by: @c_34
tags/v1.1.0
mindspore-ci-bot Gitee 5 years ago
parent
commit
80b5b86fe1
5 changed files with 19 additions and 11 deletions
  1. +1
    -1
      mindspore/nn/layer/pooling.py
  2. +4
    -1
      mindspore/ops/operations/__init__.py
  3. +5
    -5
      mindspore/ops/operations/array_ops.py
  4. +3
    -3
      mindspore/ops/operations/nn_ops.py
  5. +6
    -1
      mindspore/ops/operations/other_ops.py

+ 1
- 1
mindspore/nn/layer/pooling.py View File

@@ -371,7 +371,7 @@ class AvgPool1d(_PoolNd):
self.squeeze = P.Squeeze(2)

def construct(self, x):
_shape_check(self.shape(x))
x = F.depend(x, _shape_check(self.shape(x)))
batch, channel, width = self.shape(x)
if width == self.kernel_size[1]:
x = self.reduce_mean(x, 2)


+ 4
- 1
mindspore/ops/operations/__init__.py View File

@@ -82,7 +82,8 @@ from .nn_ops import (LSTM, SGD, Adam, FusedSparseAdam, FusedSparseLazyAdam, Appl
ApplyRMSProp, ApplyCenteredRMSProp, BasicLSTMCell, InTopK, UniformCandidateSampler)
from . import _quant_ops
from ._quant_ops import *
from .other_ops import (Assign, InplaceAssign, IOU, BoundingBoxDecode, BoundingBoxEncode, PopulationCount,
from .other_ops import (Assign, InplaceAssign, IOU, BoundingBoxDecode, BoundingBoxEncode,
ConfusionMatrix, PopulationCount,
CheckValid, MakeRefKey, Partial, Depend, identity, CheckBprop, Push, Pull)
from ._thor_ops import (CusBatchMatMul, CusCholeskyTrsm, CusFusedAbsMax1, CusImg2Col, CusMatMulCubeDenseLeft,
CusMatMulCubeFraczRightMul, CusMatMulCube, CusMatrixCombine, CusTranspose02314,
@@ -289,6 +290,7 @@ __all__ = [
'DepthwiseConv2dNative',
'UnsortedSegmentSum',
'UnsortedSegmentMin',
'UnsortedSegmentMax',
'UnsortedSegmentProd',
"AllGather",
"AllReduce",
@@ -377,6 +379,7 @@ __all__ = [
"UniformCandidateSampler",
"LRN",
"Mod",
"ConfusionMatrix",
"PopulationCount",
"ParallelConcat",
"Push",


+ 5
- 5
mindspore/ops/operations/array_ops.py View File

@@ -2146,12 +2146,12 @@ class Slice(PrimitiveWithInfer):
Slices a tensor in the specified shape.

Inputs:
x (Tensor): The target tensor.
begin (tuple): The beginning of the slice. Only constant value is allowed.
size (tuple): The size of the slice. Only constant value is allowed.
- **x** (Tensor): The target tensor.
- **begin** (tuple): The beginning of the slice. Only constant value is allowed.
- **size** (tuple): The size of the slice. Only constant value is allowed.

Returns:
Tensor.
Outputs:
Tensor, the shape is : input `size`, the data type is the same as input `x`.

Examples:
>>> data = Tensor(np.array([[[1, 1, 1], [2, 2, 2]],


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

@@ -5427,7 +5427,7 @@ class Dropout(PrimitiveWithInfer):

Args:
keep_prob (float): The keep rate, between 0 and 1, e.g. keep_prob = 0.9,
means dropping out 10% of input units.
means dropping out 10% of input units.

Inputs:
- **input** (Tensor) - The input tensor.
@@ -5441,9 +5441,9 @@ class Dropout(PrimitiveWithInfer):
>>> x = Tensor((20, 16, 50, 50), mindspore.float32)
>>> output, mask = dropout(x)
>>> print(output)
[ 0. 32. 0. 0.]
[0. 32. 0. 0.]
>>> print(mask)
[0. 1. 0. 0.]
[0. 1. 0. 0.]
"""

@prim_attr_register


+ 6
- 1
mindspore/ops/operations/other_ops.py View File

@@ -492,7 +492,12 @@ class ConfusionMatrix(PrimitiveWithInfer):
>>> confusion_matrix = P.ConfusionMatrix(4)
>>> labels = Tensor([0, 1, 1, 3], mindspore.int32)
>>> predictions = Tensor([1, 2, 1, 3], mindspore.int32)
>>> confusion_matrix(labels, predictions)
>>> output = confusion_matrix(labels, predictions)
>>> print(output)
[[0 1 0 0
[0 1 1 0]
[0 0 0 0]
[0 0 0 1]]
"""

@prim_attr_register


Loading…
Cancel
Save