torch_conv2d function

Conv2d

Conv2d

torch_conv2d( input, weight, bias = list(), stride = 1L, padding = 0L, dilation = 1L, groups = 1L )

Arguments

  • input: input tensor of shape (\mboxminibatch,\mboxin_channels,iH,iW)(\mbox{minibatch} , \mbox{in\_channels} , iH , iW)
  • weight: filters of shape (\mboxout_channels,\mboxin_channels\mboxgroups,kH,kW)(\mbox{out\_channels} , \frac{\mbox{in\_channels}}{\mbox{groups}} , kH , kW)
  • bias: optional bias tensor of shape (\mboxout_channels)(\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: implicit paddings on both sides of the input. Can be a single number or a tuple (padH, padW). Default: 0
  • dilation: the spacing between kernel elements. Can be a single number or a tuple (dH, dW). Default: 1
  • groups: split input into groups, \mboxin_channels\mbox{in\_channels} should be divisible by the number of groups. Default: 1

conv2d(input, weight, bias=NULL, stride=1, padding=0, dilation=1, groups=1) -> Tensor

Applies a 2D convolution over an input image composed of several input planes.

See nn_conv2d() for details and output shape.

Examples

if (torch_is_installed()) { # With square kernels and equal stride filters = torch_randn(c(8,4,3,3)) inputs = torch_randn(c(1,4,5,5)) nnf_conv2d(inputs, filters, padding=1) }
  • Maintainer: Daniel Falbel
  • License: MIT + file LICENSE
  • Last published: 2025-02-14