Skip to main content

ClikaRT::ops::conv1d

function

conv1d()

Tensor conv1d(
    Tensor x,
    Tensor weight,
    OptionalTensor bias = {},
    ClikaRT::Span<const std::int64_t> stride = {1},
    ClikaRT::Span<const std::int64_t> padding = {0},
    ClikaRT::Span<const std::int64_t> dilation = {1},
    int64_t groups = 1,
    Activation activation = Activation::Identity
)

1-D convolution over a channels-last input.

Layout is channels-last: input [N, spatial.., C], weight OHWI [O, K.., C/groups] (output channels first, kernel dims, then the per-group input channels), optional bias [O].

Parameters

  • x: [N, L, C].
  • weight: [O, K, C/groups] (OHWI).
  • bias: optional [O].
  • stride: per-dim strides. Default {1}.
  • padding: per-dim zero padding. Default {0}.
  • dilation: per-dim kernel dilation. Default all 1.
  • groups: channel groups; C and O must divide by it. Default 1.

Throws

  • ClikaRT::Error: when the channel/group arithmetic or a span length is inconsistent, or the dtype is not served (code_name() carries the reason).

Returns: [N, out-spatial.., O]; each spatial dim per the usual conv arithmetic (in + 2*pad - dilation*(K-1) - 1)/stride + 1.

auto y = ClikaRT::ops::conv1d(x, w, b); // channels-last in, [N, .., O] out

Declared in ClikaRT/compute/ops.h, line 1795