Skip to main content

ClikaRT::ops::causal_conv_update

function

causal_conv_update()

Tensor causal_conv_update(
    Tensor x,
    Tensor weight,
    OptionalTensor bias,
    Tensor state,
    OptionalTensor seq_lens = {},
    OptionalTensor slot_ids = {},
    std::optional<Activation> activation = std::nullopt
)

Depthwise causal short-conv serving step over a rolling per-sequence window. x [B, S, dim]; weight [dim, W] (oldest tap first); optional bias [dim]; state [B, dim, W] (same dtype as x) is read AND updated IN PLACE in both modes: S > 1 runs the prefill conv with each row's left context seeded from its window (a zero window is a fresh sequence, bit for bit; an S-token call over committed state equals S single-token steps exactly) and re-captures the window as the last W of (old window ++ the row's valid inputs; zero valid tokens leave it unchanged); S == 1 shift-inserts the new token and emits the tap dot. seq_lens ([B] Int32) bounds ragged prefill rows (their padding is zero post-activation). activation applies to the returned out [B, S, dim] only (Silu fuses in-kernel); the stored window stays pre-activation raw. slot_ids ([B] Int32, device-resident) addresses state as a SLAB [num_slots, dim, W]: batch row b reads/updates slab row slot_ids[b] in place (ids in range and DISTINCT per call, the caller's contract); absent keeps state row b.

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