forked from mindspore-Ecosystem/mindspore
fix the docs of operators like Pad, MatrixDiag, Cellist and DemseThor
This commit is contained in:
parent
f9c910e40a
commit
9dfd4047e6
|
@ -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)
|
||||
|
|
|
@ -262,7 +262,7 @@ class CellList(_CellListBase, Cell):
|
|||
>>> cell_ls
|
||||
CellList<
|
||||
(0): Conv2d<input_channels=100, output_channels=20, kernel_size=(3, 3),stride=(1, 1), pad_mode=same,
|
||||
padding=0, dilation=(1, 1), group=1, has_bias=Falseweight_init=normal, bias_init=zeros, format=NCHW>
|
||||
padding=0, dilation=(1, 1), group=1, has_bias=False, weight_init=normal, bias_init=zeros, format=NCHW>
|
||||
(1): BatchNorm2d<num_features=20, eps=1e-05, momentum=0.09999999999999998, gamma=Parameter (name=1.gamma,
|
||||
shape=(20,), dtype=Float32, requires_grad=True), beta=Parameter (name=1.beta, shape=(20,), dtype=Float32,
|
||||
requires_grad=True), moving_mean=Parameter (name=1.moving_mean, shape=(20,), dtype=Float32,
|
||||
|
|
|
@ -68,11 +68,12 @@ class DenseThor(Cell):
|
|||
``Ascend`` ``GPU``
|
||||
|
||||
Examples:
|
||||
>>> 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,
|
||||
|
|
Loading…
Reference in New Issue