From ce5e320b933e6b54f24c36be3b8a4a08e4ce089a Mon Sep 17 00:00:00 2001 From: wangshuide2020 Date: Thu, 15 Jul 2021 16:16:12 +0800 Subject: [PATCH] update the result of example for Split, Tril, Triu and ApplyFtrl. --- mindspore/nn/layer/basic.py | 64 +++++++++++++-------------- mindspore/numpy/array_creations.py | 10 ++--- mindspore/ops/operations/array_ops.py | 2 +- mindspore/ops/operations/nn_ops.py | 8 ++-- 4 files changed, 42 insertions(+), 42 deletions(-) diff --git a/mindspore/nn/layer/basic.py b/mindspore/nn/layer/basic.py index 1b3dd5e4805..072616be7b1 100644 --- a/mindspore/nn/layer/basic.py +++ b/mindspore/nn/layer/basic.py @@ -1013,10 +1013,10 @@ class Tril(Cell): >>> tril = nn.Tril() >>> result = tril(x) >>> print(result) - [[ 1, 0, 0, 0], - [ 5, 6, 0, 0], - [10, 11, 12, 0], - [14, 15, 16, 17]])) + [[ 1 0 0 0] + [ 5 6 0 0] + [10 11 12 0] + [14 15 16 17]] >>> x = Tensor(np.array([[ 1, 2, 3, 4], ... [ 5, 6, 7, 8], ... [10, 11, 12, 13], @@ -1024,10 +1024,10 @@ class Tril(Cell): >>> tril = nn.Tril() >>> result = tril(x, 1) >>> print(result) - [[ 1, 2, 0, 0], - [ 5, 6, 7, 0], - [10, 11, 12, 13], - [14, 15, 16, 17]])) + [[ 1 2 0 0] + [ 5 6 7 0] + [10 11 12 13] + [14 15 16 17]] >>> x = Tensor(np.array([[ 1, 2, 3, 4], ... [ 5, 6, 7, 8], ... [10, 11, 12, 13], @@ -1035,10 +1035,10 @@ class Tril(Cell): >>> tril = nn.Tril() >>> result = tril(x, 2) >>> print(result) - [[ 1, 2, 3, 0], - [ 5, 6, 7, 8], - [10, 11, 12, 13], - [14, 15, 16, 17]])) + [[ 1 2 3 0] + [ 5 6 7 8] + [10 11 12 13] + [14 15 16 17]] >>> x = Tensor(np.array([[ 1, 2, 3, 4], ... [ 5, 6, 7, 8], ... [10, 11, 12, 13], @@ -1046,10 +1046,10 @@ class Tril(Cell): >>> tril = nn.Tril() >>> result = tril(x, -1) >>> print(result) - [[ 0, 0, 0, 0], - [ 5, 0, 0, 0], - [10, 11, 0, 0], - [14, 15, 16, 0]])) + [[ 0 0 0 0] + [ 5 0 0 0] + [10 11 0 0] + [14 15 16 0]] """ def __init__(self): @@ -1100,10 +1100,10 @@ class Triu(Cell): >>> triu = nn.Triu() >>> result = triu(x) >>> print(result) - [[ 1, 2, 3, 4], - [ 0, 6, 7, 8], - [ 0, 0, 12, 13], - [ 0, 0, 0, 17]] + [[ 1 2 3 4] + [ 0 6 7 8] + [ 0 0 12 13] + [ 0 0 0 17]] >>> x = Tensor(np.array([[ 1, 2, 3, 4], ... [ 5, 6, 7, 8], ... [10, 11, 12, 13], @@ -1111,10 +1111,10 @@ class Triu(Cell): >>> triu = nn.Triu() >>> result = triu(x, 1) >>> print(result) - [[ 0, 2, 3, 4], - [ 0, 0, 7, 8], - [ 0, 0, 0, 13], - [ 0, 0, 0, 0]] + [[ 0 2 3 4] + [ 0 0 7 8] + [ 0 0 0 13] + [ 0 0 0 0]] >>> x = Tensor(np.array([[ 1, 2, 3, 4], ... [ 5, 6, 7, 8], ... [10, 11, 12, 13], @@ -1122,10 +1122,10 @@ class Triu(Cell): >>> triu = nn.Triu() >>> result = triu(x, 2) >>> print(result) - [[ 0, 0, 3, 4], - [ 0, 0, 0, 8], - [ 0, 0, 0, 0], - [ 0, 0, 0, 0]] + [[ 0 0 3 4] + [ 0 0 0 8] + [ 0 0 0 0] + [ 0 0 0 0]] >>> x = Tensor(np.array([[ 1, 2, 3, 4], ... [ 5, 6, 7, 8], ... [10, 11, 12, 13], @@ -1133,10 +1133,10 @@ class Triu(Cell): >>> triu = nn.Triu() >>> result = triu(x, -1) >>> print(result) - [[ 1, 2, 3, 4], - [ 5, 6, 7, 8], - [ 0, 11, 12, 13], - [ 0, 0, 16, 17]] + [[ 1 2 3 4] + [ 5 6 7 8] + [ 0 11 12 13] + [ 0 0 16 17]] """ def __init__(self): diff --git a/mindspore/numpy/array_creations.py b/mindspore/numpy/array_creations.py index b5e83924e36..3861a35b06c 100644 --- a/mindspore/numpy/array_creations.py +++ b/mindspore/numpy/array_creations.py @@ -1690,11 +1690,11 @@ def vander(x, N=None, increasing=False): Examples: >>> import mindspore.numpy as np >>> print(np.vander([1., 2., 3., 4., 5.])) - [[ 1 1 1 1 1] - [ 16 8 4 2 1] - [ 81 27 9 3 1] - [256 64 16 4 1] - [625 125 25 5 1]] + [[ 1. 1. 1. 1. 1.] + [ 16. 8. 4. 2. 1.] + [ 81. 27. 9. 3. 1.] + [256. 64. 16. 4. 1.] + [625. 125. 25. 5. 1.]] """ if isinstance(x, (list, tuple)): x = asarray_const(x) diff --git a/mindspore/ops/operations/array_ops.py b/mindspore/ops/operations/array_ops.py index 246f611b225..90c47ecbcc7 100755 --- a/mindspore/ops/operations/array_ops.py +++ b/mindspore/ops/operations/array_ops.py @@ -1036,7 +1036,7 @@ class Split(PrimitiveWithCheck): >>> x = Tensor(np.array([[1, 1, 1, 1], [2, 2, 2, 2]]), mindspore.int32) >>> print(x) [[1 1 1 1] - [2 2 2 2]]) + [2 2 2 2]] >>> output = split(x) >>> print(output) (Tensor(shape=[2, 2], dtype=Int32, value= diff --git a/mindspore/ops/operations/nn_ops.py b/mindspore/ops/operations/nn_ops.py index ee5a42b375d..da16200aac3 100755 --- a/mindspore/ops/operations/nn_ops.py +++ b/mindspore/ops/operations/nn_ops.py @@ -174,8 +174,8 @@ class AdaptiveAvgPool2D(PrimitiveWithInfer): Examples: >>> # case 1: output_size=(None, 2) >>> input_x = Tensor(np.array([[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0]], - >>> [[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0]], - >>> [[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0]]]), mindspore.float32) + ... [[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0]], + ... [[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0]]]), mindspore.float32) >>> adaptive_avg_pool_2d = ops.AdaptiveAvgPool2D((None, 2)) >>> output = adaptive_avg_pool_2d(input_x) >>> print(output) @@ -6748,8 +6748,8 @@ class ApplyFtrl(PrimitiveWithInfer): >>> input_x = Tensor(np.array([[0.3, 0.7], [0.1, 0.8]]).astype(np.float32)) >>> output = net(input_x) >>> print(net.var.asnumpy()) - [[ 0.0390525, 0.11492836] - [ 0.00066425, 0.15075898]] + [[ 0.0390525 0.11492836] + [ 0.00066425 0.15075898]] """ @prim_attr_register