diff --git a/mindspore/nn/layer/basic.py b/mindspore/nn/layer/basic.py index 341657a191..90ec67624e 100644 --- a/mindspore/nn/layer/basic.py +++ b/mindspore/nn/layer/basic.py @@ -712,7 +712,7 @@ class Pad(Cell): ... self.pad = nn.Pad(paddings=((1, 1), (2, 2)), mode="CONSTANT") ... def construct(self, x): ... return self.pad(x) - >>> x = Tensor(np.array([[1, 2, 3], [4, 5, 6]]), mindsprore.float32) + >>> x = Tensor(np.array([[1, 2, 3], [4, 5, 6]]), mindspore.float32) >>> pad = Net() >>> output = pad(x) >>> print(output) @@ -1277,7 +1277,7 @@ class MatrixDiagPart(Cell): >>> x = Tensor([[-1, 0, 0, 1], ... [-1, 0, 0, 1], ... [-1, 0, 0, 1], - ... [-1, 0, 0, 1], mindspore.float32) + ... [-1, 0, 0, 1]], mindspore.float32) >>> matrix_diag_part = nn.MatrixDiagPart() >>> output = matrix_diag_part(x) >>> print(output) diff --git a/mindspore/nn/layer/container.py b/mindspore/nn/layer/container.py index 4973dab1c8..6f0541d3e0 100644 --- a/mindspore/nn/layer/container.py +++ b/mindspore/nn/layer/container.py @@ -262,7 +262,7 @@ class CellList(_CellListBase, Cell): >>> cell_ls CellList< (0): Conv2d + padding=0, dilation=(1, 1), group=1, has_bias=False, weight_init=normal, bias_init=zeros, format=NCHW> (1): BatchNorm2d>> x = Tensor(np.random.randint(0, 255, [2, 3]), mindspore.float32) - >>> net = nn.DenseThor(3, 4) - >>> net(x) - [[ 2.5246444 2.2738023 0.5711005 -3.9399147 ] - [ 1.0739875 4.0155234 0.94188046 -5.459526 ]] + >>> x = Tensor(np.array([[1, 2, 3], [3, 4, 5]]), mindspore.float32) + >>> net = nn.DenseThor(3, 4, weight_init="ones") + >>> output = net(x) + >>> print(output) + [[ 6. 6. 6. 6.] + [ 12. 12. 12. 12. ]] """ def __init__(self, in_channels,