mindspore.mint.nn.ReplicationPad3d
- class mindspore.mint.nn.ReplicationPad3d(padding)[source]
Pad the last 3-D dimensions of input tensor using the replication of the input boundary.
For more information, please refer to
mindspore.mint.nn.functional.pad().Warning
This is an experimental API that is subject to change or deletion.
- Parameters
padding (Union[int, tuple, list]) –
Specifies padding size.
If an int, pads all boundaries with the same amount.
If a tuple or list, it should be in the order \((\text{padding_left}, \text{padding_right}, \text{padding_top}, \\ \text{padding_bottom}, \text{padding_front}, \text{padding_back})\).
- Inputs:
input (Tensor) - The input tensor, with shape \((C, D_{in}, H_{in}, W_{in})\) or \((N, C, D_{in}, H_{in}, W_{in})\).
- Outputs:
Tensor, with shape \((C, D_{out}, H_{out}, W_{out})\) or \((N, C, D_{out}, H_{out}, W_{out})\), where:
\(D_{out} = D_{in} + \text{padding_front} + \text{padding_back}\)
\(H_{out} = H_{in} + \text{padding_top} + \text{padding_bottom}\)
\(W_{out} = W_{in} + \text{padding_left} + \text{padding_right}\)
- Supported Platforms:
Ascend
Examples
>>> import mindspore >>> pad3d = mindspore.mint.nn.ReplicationPad3d(1) >>> input = mindspore.tensor(mindspore.mint.arange(0, 9).reshape(1, 1, 1, 3, 3), mindspore.float32) >>> out = pad3d(input) >>> print(out) [[[[[0. 0. 1. 2. 2.] [0. 0. 1. 2. 2.] [3. 3. 4. 5. 5.] [6. 6. 7. 8. 8.] [6. 6. 7. 8. 8.]] [[0. 0. 1. 2. 2.] [0. 0. 1. 2. 2.] [3. 3. 4. 5. 5.] [6. 6. 7. 8. 8.] [6. 6. 7. 8. 8.]] [[0. 0. 1. 2. 2.] [0. 0. 1. 2. 2.] [3. 3. 4. 5. 5.] [6. 6. 7. 8. 8.] [6. 6. 7. 8. 8.]]]]]