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,.,.) =
#> 1.6393 -2.5899 -8.5067 -1.8238 4.1000
#> 2.1120 -4.1321 11.0553 3.7196 0.7362
#> -5.2617 2.5456 3.9080 -2.5368 4.2549
#> 3.5291 -15.2413 8.2195 -11.3693 3.8103
#> 0.2621 9.5971 -0.2704 6.1829 3.7084
#>
#> (1,2,.,.) =
#> 0.1694 -2.0025 -8.5001 -1.3313 -0.2288
#> -2.2929 2.0407 -4.5657 7.2870 1.5678
#> -0.9393 -5.8278 -4.1736 -12.8371 -2.7586
#> -4.2690 -9.7113 1.7583 -7.1215 -3.1604
#> -0.0940 2.4235 1.7249 -0.8745 -0.4284
#>
#> (1,3,.,.) =
#> 0.0273 -2.1521 -8.8350 -8.4736 -2.5637
#> 3.0278 -3.4849 2.8462 -8.2803 -3.2730
#> -1.9833 4.1347 3.1995 -8.7701 -8.4042
#> 8.3239 -4.1759 1.5025 -6.0144 -4.1036
#> -2.2783 4.2398 2.8385 -1.0805 0.1099
#>
#> (1,4,.,.) =
#> -1.5909 0.1692 -2.3328 -3.3655 3.3153
#> 6.5030 -14.5062 3.9954 -8.0446 6.3689
#> 6.4542 -2.9360 8.0266 -2.8897 -0.0591
#> -0.9082 3.0974 0.4244 -1.1744 6.8117
#> -3.8428 -9.7227 4.2513 1.6934 1.2398
#>
#> (1,5,.,.) =
#> 0.2714 -4.2587 0.2697 -1.6718 1.1456
#> ... [the output was truncated (use n=-1 to disable)]
#> [ CPUFloatType{1,8,5,5} ]