mindspore.mint.nn.ReflectionPad3d
- class mindspore.mint.nn.ReflectionPad3d(padding)[source]
Pad the last 3-D dimensions of input tensor using the reflection 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 it is an int, pads all boundaries with the same amount.
If it is 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, the tensor after padding, 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 >>> arr = mindspore.mint.arange(8).astype(mindspore.float32).reshape((1, 2, 2, 2)) >>> x = mindspore.tensor(arr) >>> padding = (1, 1, 1, 0, 0, 1) >>> pad3d = mindspore.mint.nn.ReflectionPad3d(padding) >>> out = pad3d(x) >>> print(out) [[[[3. 2. 3. 2.] [1. 0. 1. 0.] [3. 2. 3. 2.]] [[7. 6. 7. 6.] [5. 4. 5. 4.] [7. 6. 7. 6.]] [[3. 2. 3. 2.] [1. 0. 1. 0.] [3. 2. 3. 2.]]]]