CircularPad3D
- class paddle.nn. CircularPad3D ( padding: Tensor | Sequence[int] | int, data_format: DataLayout3D = 'NCDHW', name: str | None = None ) [source]
-
This interface is used to construct a callable object of the
CircularPad3Dclass. Pads the input tensor boundaries by circular padding.- Parameters
-
padding (Tensor | Sequence[int] | int) – The padding size. If padding is an int, the same padding is applied to all six sides (left, right, top, bottom, front, back). If padding is a list or tuple of six ints, it is interpreted as (pad_left, pad_right, pad_top, pad_bottom, pad_front, pad_back).
data_format (str|None) – An string from: “NCDHW”, “NDHWC”. Specify the data format of the input data. Default:
"NCDHW"name (str|None, optional) – The default value is None. Normally there is no need for user to set this property. For more information, please refer to api_guide_Name.
- Shape:
-
x(Tensor): The input tensor of circularpad3d operator, which is a 5-D tensor. The data type can be float32, float64.
output(Tensor): The output tensor of circularpad3d operator, which is a 5-D tensor. The data type is same as input x.
- Returns
-
The padded tensor.
- Return type
-
Tensor
Examples
>>> import paddle >>> import paddle.nn as nn >>> input_shape = (1, 1, 1, 2, 3) # NCDHW >>> pad = [1, 0, 1, 2, 0, 0] # (L, R, T, B, F, K) >>> data = paddle.arange(paddle.prod(paddle.to_tensor(input_shape)), dtype="float32").reshape(input_shape) + 1 >>> # data is [[[[[1., 2., 3.], >>> # [4., 5., 6.]]]]] >>> my_pad = nn.CircularPad3D(padding=pad) >>> result = my_pad(data) >>> print(result) Tensor(shape=[1, 1, 1, 5, 4], dtype=float32, place=Place(cpu), stop_gradient=True, [[[[[6., 4., 5., 6.], [3., 1., 2., 3.], [6., 4., 5., 6.], [3., 1., 2., 3.], [6., 4., 5., 6.]]]]])
