conv_transpose¶
dragon.nn.
conv_transpose
(
inputs,
kernel_shape=(3, 3),
strides=1,
pads=0,
dilations=1,
group=1,
padding='VALID',
output_padding=None,
output_shape=None,
data_format='NCHW',
**kwargs
)[source]¶Apply the n-dimension deconvolution.
- If
data_format
is'NCHW'
, excepts input shape \((N, C_{\text{in}}, D1, D2, ...)\), weight shape \((C_{\text{in}}, C_{\text{out}}, D1_{\text{k}}, D2_{\text{k}}, ...)\), and output shape is \((N, C_{\text{out}}, D1_{\text{out}}, D2_{\text{out}}, ...)\). - If
data_format
is'NHWC'
, excepts input shape \((N, D1, D2, ..., C_{\text{in}})\), weight shape \((C_{\text{in}}, D1_{\text{k}}, D2_{\text{k}}, ..., C_{\text{out}})\), and output shape is \((N, D1_{\text{out}}, D2_{\text{out}}, ..., C_{\text{out}})\). - If
padding
is'VALID'
,pads
controls the explicit padding size. Otherwise, size are computed automatically use the given method.
Examples:
for i in range(3): ndim = i + 1 x = dragon.ones((1, 2) + (2,) * ndim) w = dragon.ones((3, 2) + (1,) * ndim) y = dragon.nn.conv_transpose( [x, w], kernel_shape=(1,) * ndim, output_shape=(3,) * ndim, output_padding=(1,) * ndim) assert y.shape == (1, 3) + (3,) * ndim
- Parameters:
- inputs (Sequence[dragon.Tensor]) – The tensor
x
,weight
and optionalbias
. - kernel_shape (Sequence[int], optional, default=(3, 3)) – The shape of convolution window.
- strides (Union[int, Sequence[int]], optional, default=1) – The stride of convolution window.
- pads (Union[int, Sequence[int]], optional, default=0) – The zero padding size.
- dilations (Union[int, Sequence[int]], optional, default=1) – The rate of dilated convolution.
- group (int, optional, default=1) – The number of groups to split channels into.
- padding (str, optional, default='VALID') –
'VALID'
,'SAME'
,'SAME_UPPER'
or'SAME_LOWER'
. - output_padding (Union[Sequence[int], dragon.Tensor], optional) – The additional size added to the output shape.
- output_shape (Union[Sequence[int], dragon.Tensor], optional) – The output shape for automatic padding.
- data_format (str, optional, default='NCHW') –
'NCHW'
or'NHWC'
.
- inputs (Sequence[dragon.Tensor]) – The tensor
- Returns:
dragon.Tensor – The output tensor.
- If