mindspore.mint.nn.ReplicationPad3d
- class mindspore.mint.nn.ReplicationPad3d(padding)[source]
Pad the last 3 dimension 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.
- Inputs:
input (Tensor) - 4D or 5D input Tensor with shape: \((N, D_{in}, H_{in}, W_{in})\) or \((N, C, D_{in}, H_{in}, W_{in})\).
- Outputs:
Tensor, the tensor after padding.
- Raises
TypeError – If padding is not an integer of a list or tuple of 6 integers.
TypeError – If input is not Tensor.
ValueError – If padding is a tuple or list, and the length does not match the tensor dimension.
- Supported Platforms:
Ascend
Examples
>>> import numpy as np >>> import mindspore as ms >>> pad3d = ms.mint.nn.ReplicationPad3d(1) >>> input = ms.Tensor(np.arange(0, 9).reshape(1, 1, 1, 3, 3), ms.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.]]]]]