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.9030 2.3719 3.2671 -6.3717 4.9661
#> -9.3490 -2.2151 2.7751 -1.1339 1.3596
#> -3.3151 2.1332 11.8538 -1.7507 -3.1123
#> 1.8214 -5.5401 5.5321 -2.6120 4.0258
#> -7.6614 4.7752 2.8485 7.5207 -3.6628
#>
#> (1,2,.,.) =
#> 5.2193 2.6121 -1.2951 5.8279 -10.5490
#> 1.0212 3.0566 5.3418 -0.5528 -19.0809
#> -2.4759 5.2707 -1.3049 -11.1098 -0.6705
#> -0.8664 7.7155 -7.3916 13.1146 3.6660
#> 3.2671 -6.9516 8.2204 4.8681 -4.0088
#>
#> (1,3,.,.) =
#> -8.2957 5.5987 3.3467 -3.6443 1.0645
#> 8.2492 -3.3375 -6.9863 -6.0146 -8.4941
#> 3.4540 -3.0300 -5.0501 5.6115 1.7198
#> 7.3158 -2.3231 0.1430 -0.7191 10.1638
#> -0.5320 -0.4238 -2.4003 2.9976 3.9288
#>
#> (1,4,.,.) =
#> 8.2648 3.0973 10.2399 3.8716 -6.8306
#> 1.4585 3.1623 -1.6594 3.6279 1.1162
#> 2.4186 -4.9536 4.4081 -3.1237 -8.9828
#> -7.3744 -2.3638 0.2175 8.9855 1.6173
#> 1.3701 3.9888 3.5332 2.9809 0.5901
#>
#> (1,5,.,.) =
#> -3.8535 -3.2569 7.7058 -1.4514 -1.5325
#> ... [the output was truncated (use n=-1 to disable)]
#> [ CPUFloatType{1,8,5,5} ]