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,.,.) =
#> -2.0469 6.8965 2.2824 0.7413 -1.7839
#> 2.6364 -0.6391 3.7199 6.0697 4.2116
#> -0.0825 0.3471 5.1797 -1.5637 -2.4511
#> -0.9958 -6.2406 -1.1302 7.3218 -4.8061
#> 3.1420 5.6589 1.1481 -3.4635 -4.3349
#>
#> (1,2,.,.) =
#> -0.0625 9.7216 -0.8842 -1.4253 -5.7067
#> -3.0789 -5.8568 5.8401 -9.1868 9.1566
#> -3.4006 -18.0903 -6.0409 -0.3181 -6.7024
#> 1.5335 3.1239 -6.7233 -6.1053 -1.5695
#> 3.3702 -1.5255 7.5491 2.2492 4.7114
#>
#> (1,3,.,.) =
#> 2.0660 -1.3346 -7.2633 9.9080 1.9119
#> -3.9492 3.4750 -0.8488 1.0503 -2.8849
#> 4.4364 11.8931 2.1887 -2.0250 -8.6386
#> -5.0817 5.7824 -1.2759 2.9925 1.5391
#> -0.4887 -1.7196 -1.2222 1.6082 -5.2522
#>
#> (1,4,.,.) =
#> -5.4745 9.8597 -1.2085 3.5830 -6.7843
#> 1.0956 -0.8899 -1.3172 -6.3585 4.0398
#> 0.7158 -0.2060 -5.1184 0.9738 -4.9517
#> 6.7638 2.7534 -1.4643 1.9107 -1.9628
#> 1.4582 -6.6380 -0.9650 7.7854 2.0511
#>
#> (1,5,.,.) =
#> 1.7293 3.8884 -9.8820 -1.9416 0.9031
#> ... [the output was truncated (use n=-1 to disable)]
#> [ CPUFloatType{1,8,5,5} ]