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,.,.) =
#> -3.7738 -1.2083 -8.1065 1.3506 5.4331
#> -2.6131 2.3640 1.2309 1.4801 -5.3338
#> -5.0187 -2.4033 0.5710 -1.6880 7.3623
#> -1.5215 1.5235 0.0348 7.3801 -1.7101
#> -8.5764 -2.9294 4.9842 3.5400 -1.8436
#>
#> (1,2,.,.) =
#> -4.6851 1.3777 -1.4969 -11.3123 6.7215
#> -1.5802 8.2403 8.6541 3.3405 1.9431
#> -2.2322 8.4269 1.9300 0.1297 -2.2860
#> 8.3438 -7.1255 -1.8514 -2.1738 7.8578
#> 0.0024 -1.7037 0.2490 -2.8967 1.0559
#>
#> (1,3,.,.) =
#> 2.5347 7.3605 0.8325 7.3045 -2.8945
#> 2.2124 5.4812 7.6731 -4.5134 -1.1054
#> 1.7022 -7.9886 -2.7748 -3.1381 7.6821
#> -14.2288 0.4543 2.5085 2.6854 -6.7399
#> -4.9975 -1.9640 -1.2460 0.0871 5.4244
#>
#> (1,4,.,.) =
#> -4.2018 2.5438 3.7225 6.2680 6.3939
#> 0.4814 1.8399 2.2175 -1.8820 -11.3187
#> 1.7938 -1.3694 -9.8122 3.0611 5.0931
#> 7.7106 0.4313 3.9273 -3.4084 1.6744
#> 6.5445 -1.2279 -2.0083 -1.1604 -0.0577
#>
#> (1,5,.,.) =
#> 0.0969 0.6377 4.5573 5.0655 1.0746
#> ... [the output was truncated (use n=-1 to disable)]
#> [ CPUFloatType{1,8,5,5} ]