Conv_transpose2d
Source:R/gen-namespace-docs.R
, R/gen-namespace-examples.R
, R/gen-namespace.R
torch_conv_transpose2d.Rd
Conv_transpose2d
Usage
torch_conv_transpose2d(
input,
weight,
bias = list(),
stride = 1L,
padding = 0L,
output_padding = 0L,
groups = 1L,
dilation = 1L
)
Arguments
- input
input tensor of shape \((\mbox{minibatch} , \mbox{in\_channels} , iH , iW)\)
- weight
filters of shape \((\mbox{in\_channels} , \frac{\mbox{out\_channels}}{\mbox{groups}} , kH , kW)\)
- bias
optional bias of shape \((\mbox{out\_channels})\). Default: NULL
- stride
the stride of the convolving kernel. Can be a single number or a tuple
(sH, sW)
. Default: 1- padding
dilation * (kernel_size - 1) - padding
zero-padding will be added to both sides of each dimension in the input. Can be a single number or a tuple(padH, padW)
. Default: 0- output_padding
additional size added to one side of each dimension in the output shape. Can be a single number or a tuple
(out_padH, out_padW)
. Default: 0- groups
split input into groups, \(\mbox{in\_channels}\) should be divisible by the number of groups. Default: 1
- dilation
the spacing between kernel elements. Can be a single number or a tuple
(dH, dW)
. Default: 1
conv_transpose2d(input, weight, bias=NULL, stride=1, padding=0, output_padding=0, groups=1, dilation=1) -> Tensor
Applies a 2D transposed convolution operator over an input image composed of several input planes, sometimes also called "deconvolution".
See nn_conv_transpose2d()
for details and output shape.
Examples
if (torch_is_installed()) {
# With square kernels and equal stride
inputs = torch_randn(c(1, 4, 5, 5))
weights = torch_randn(c(4, 8, 3, 3))
nnf_conv_transpose2d(inputs, weights, padding=1)
}
#> torch_tensor
#> (1,1,.,.) =
#> -6.3960 9.1232 -2.8004 -1.3868 1.3521
#> 1.4934 6.9319 -11.9201 6.7481 1.3496
#> -1.8785 5.5954 3.4016 5.5397 -7.6467
#> -1.9971 6.6623 2.2538 1.6590 -3.4015
#> -1.4083 -0.7698 1.2899 -4.0362 6.8385
#>
#> (1,2,.,.) =
#> -3.6573 0.8038 -0.9764 -4.4286 -2.6406
#> -3.2724 1.0349 6.4589 -2.6047 -0.3668
#> 4.8154 2.5700 3.9379 -0.8989 1.1496
#> -2.0347 2.7453 7.1114 -4.0670 -5.2499
#> -0.4703 7.3308 2.6528 1.6839 0.5830
#>
#> (1,3,.,.) =
#> 5.9283 -0.5292 -8.0352 4.0898 3.5460
#> -1.8120 -7.5394 2.6333 5.9905 -3.7589
#> -3.2381 1.3461 -0.6741 -3.1322 -0.7111
#> 3.2499 -3.0140 0.1912 -10.1276 1.3264
#> 2.0959 0.8129 -0.2942 3.0702 2.4320
#>
#> (1,4,.,.) =
#> -11.1249 -7.8550 2.3842 4.4185 3.0066
#> -3.9357 -4.3043 2.8180 5.1852 3.9617
#> -2.1041 -5.2036 -5.1153 -2.4998 0.3958
#> -2.9048 -0.2169 -2.5775 5.0386 -5.3678
#> -0.0440 1.9224 1.6378 -2.5885 0.3614
#>
#> (1,5,.,.) =
#> 2.6500 -0.2922 0.9965 -2.6890 -1.1816
#> ... [the output was truncated (use n=-1 to disable)]
#> [ CPUFloatType{1,8,5,5} ]