IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Python function

causal_conv1d_varlen_fwd

causal_conv1d_varlen_fwd()​

max.nn.state_space.causal_conv1d_varlen_fwd(x, weight, bias, conv_states, query_start_loc, cache_indices, has_initial_state, activation='silu', channels_last=False)

source

Applies a slot-indexed varlen causal depthwise conv1d for prefill and decode.

Mutates the conv-state pool conv_states in place at slot cache_indices[batch_item] — the Qwen3.5 GatedDeltaNet conv pattern. The builtin registers conv_states as a MutableInputTensor at operand position 4 (after output, x, weight, bias).

Parameters:

  • x (TensorValue) – The [dim, total_seqlen] input (channels-first, model dtype), or [total_seqlen, dim] when channels_last is true.
  • weight (TensorValue) – The [dim, width] depthwise conv weights.
  • bias (TensorValue) – The [dim] per-channel bias (empty to disable).
  • conv_states (BufferValue) – The [max_slots, dim, width - 1] mutable conv-state pool.
  • query_start_loc (TensorValue) – The [batch + 1] int32 cumulative sequence lengths.
  • cache_indices (TensorValue) – The [batch] int32 slot indices into conv_states.
  • has_initial_state (TensorValue) – The [batch] bool, whether to use the stored state.
  • activation (str) – "silu" or "none".
  • channels_last (bool) – If true, x and the output are tokens-major [total_seqlen, dim]. The kernel indexes through runtime strides, so this only relabels the axes — it avoids the materialized transposes the [dim, total_seqlen] contract forces on a tokens-major caller.

Returns:

The conv output with the same shape/layout as x. conv_states is mutated in place.

Return type:

TensorValue