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
- weight
filters of shape
- bias
optional bias of shape
. 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,
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.1253 5.4441 0.1970 -3.6803 -3.4119
#> 2.4322 2.1541 12.5961 6.5995 5.1548
#> -0.6315 -6.8499 -3.0669 -1.1467 -1.7125
#> 1.9091 -2.0217 7.8142 -3.3610 -7.9866
#> -3.9312 -4.6840 8.8192 5.3539 13.4730
#>
#> (1,2,.,.) =
#> -4.5093 6.1076 3.1789 4.3431 -0.7988
#> -4.7695 -11.7868 -1.9039 -3.8325 5.6265
#> -9.8235 -3.9974 8.8578 14.6611 1.8173
#> 2.7077 -9.4768 -7.3567 -9.8555 -3.8919
#> -1.9548 -1.2049 3.1667 9.8986 8.7437
#>
#> (1,3,.,.) =
#> 2.8846 1.9904 -2.0205 3.7424 -1.4139
#> -2.3467 -7.5063 5.6216 -4.8747 -0.7202
#> 6.3255 6.5974 -3.7416 4.3378 -5.9021
#> 0.4539 5.2796 -2.6167 3.5263 4.8052
#> 3.7287 3.2542 1.0560 5.3785 -1.1284
#>
#> (1,4,.,.) =
#> -6.3726 -2.3501 1.6128 11.2059 0.7719
#> -3.2164 -4.2570 -1.9258 1.2205 -1.6253
#> -9.2520 1.2597 -5.7226 -10.1837 2.9304
#> 5.2055 -5.9076 -0.5576 2.1778 5.3254
#> -1.6957 -1.5328 5.0729 4.5368 4.7827
#>
#> (1,5,.,.) =
#> 0.4434 0.8264 2.0969 -2.7700 4.8120
#> ... [the output was truncated (use n=-1 to disable)]
#> [ CPUFloatType{1,8,5,5} ]