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,.,.) =
#> -5.5720 2.3667 -7.3122 1.8423 -7.2982
#> -15.0026 11.1871 7.9955 1.8424 2.3371
#> -2.8116 -17.4704 2.5230 5.1196 -5.6054
#> -1.4614 -6.1795 3.9634 12.5255 -2.1163
#> 1.1044 2.6077 6.8300 -12.8440 4.9745
#>
#> (1,2,.,.) =
#> -4.6798 5.5129 -12.2860 6.4341 -2.4183
#> 0.9886 -0.3579 -4.6331 0.4319 -10.0591
#> 8.2584 -1.5428 -3.7279 -1.1404 -0.7823
#> 5.4069 -0.9679 4.2820 1.0843 -4.3021
#> 3.5690 -8.6112 3.1458 2.1084 -5.5530
#>
#> (1,3,.,.) =
#> -5.4202 6.6819 -3.9673 -4.9739 4.2795
#> 2.0982 5.8091 20.1453 -1.4443 -0.1709
#> 9.0929 -10.6066 -1.4184 1.1135 -10.7833
#> 3.6100 1.2725 -2.3199 -3.6965 5.1756
#> -8.0629 2.0840 -5.6910 -7.6491 0.0520
#>
#> (1,4,.,.) =
#> 3.8247 4.7236 0.1842 -7.6635 3.5985
#> -1.5089 4.0684 0.9608 -1.9337 4.4149
#> 1.0806 0.9685 -1.0243 1.9039 -5.8585
#> -2.3477 0.9794 -3.2845 -5.9761 2.3310
#> -3.2551 -7.3461 -7.7944 -5.4622 -4.7882
#>
#> (1,5,.,.) =
#> -1.2285 -1.5449 -3.6510 -9.1239 7.4963
#> ... [the output was truncated (use n=-1 to disable)]
#> [ CPUFloatType{1,8,5,5} ]