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,.,.) =
#> -4.0098 -5.0313 6.8105 -1.0021 5.3903
#> -3.2639 -4.7224 -3.3878 -1.1967 4.0446
#> 10.0232 -4.4150 -8.6390 3.8996 1.6335
#> 0.9296 2.9197 -2.3360 -1.6417 -2.7890
#> -4.6193 11.4419 -7.5627 2.9798 -1.7773
#>
#> (1,2,.,.) =
#> -0.1793 3.5783 4.7631 5.9809 2.0518
#> 1.5537 -4.2509 -14.4141 -4.8391 0.9355
#> -6.1943 7.3959 5.5308 -3.1655 -8.4654
#> 3.2452 -12.2044 -4.8781 3.6186 10.5318
#> 2.8551 -1.6354 1.9752 7.5736 -8.7246
#>
#> (1,3,.,.) =
#> 0.6693 -11.2314 9.6125 -3.4877 1.9307
#> -0.6870 5.4097 -4.4927 -1.0477 -7.2388
#> -10.4915 6.4477 5.2581 -2.3866 -0.1821
#> -0.8842 3.5092 0.9792 -2.6495 6.7911
#> -3.2045 -4.5648 8.2479 3.4012 -1.5479
#>
#> (1,4,.,.) =
#> 8.1714 3.0506 -0.7998 -2.1986 -6.7395
#> -7.7921 0.8190 -2.3912 -1.0331 3.8875
#> -6.4955 -1.6437 2.8152 -5.6818 -9.8899
#> 2.1046 -14.9640 -0.2641 2.2211 9.4924
#> 2.3449 1.2507 -7.8120 7.2972 -3.8666
#>
#> (1,5,.,.) =
#> -3.2535 -2.4848 5.6120 -8.4186 2.4904
#> ... [the output was truncated (use n=-1 to disable)]
#> [ CPUFloatType{1,8,5,5} ]