Skip to contents

Torch-style 3D convolution in NCDHW layout. x is [batch, in_channels, depth, height, width], weight is [out_channels, in_channels / groups, kD, kH, kW]. Asymmetric padding (e.g. causal temporal padding) is available via prim_convolution().

Usage

nv_conv3d(
  x,
  weight,
  stride = 1L,
  padding = 0L,
  dilation = 1L,
  groups = 1L,
  precision = "highest"
)

Arguments

x

(arrayish)
[N, C_in, D, H, W]. Can be any data type; x and weight are promoted to a common data type. An R value assumes the other operand's data type, and materializes at its default data type when that has none either.

weight

(arrayish)
[C_out, C_in / groups, kD, kH, kW]. Promoted together with x – see x.

stride, padding, dilation

(integer())
Length 1 or 3.

groups

(integer(1))
Grouped/depthwise convolution.

precision

(character(1))
"highest", "high" or "default".

Value

(arrayish)
Has the operands' common data type, and shape [N, C_out, out_D, out_H, out_W].

Examples

# one batch, one channel, 2x3x3, convolved with a 1x2x2 kernel
x <- nv_array(1:18, shape = c(1, 1, 2, 3, 3), dtype = "f32")
weight <- nv_fill(1, shape = c(1, 1, 1, 2, 2), dtype = "f32")
shape(nv_conv3d(x, weight))
#> [1] 1 1 2 2 2