IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/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. /max/get-started.md).

Mojo struct

CausalConv1DVarlenUpdate

struct CausalConv1DVarlenUpdate[activation: StringSlice[StaticConstantOrigin]]

Varlen causal conv1d update for autoregressive decoding.

Performs incremental convolution update for token-by-token generation. Updates the conv_state in-place with new input values.

Tensor Shapes: - output: (batch, dim, seqlen) - Output tensor - x: (batch, dim, seqlen) - Input tensor - weight: (dim, width) - Convolution weights - bias: (dim,) - Per-channel bias - conv_state: (batch, dim, state_len) - Conv state (in/out) - cache_seqlens: (batch,) - Current sequence lengths (optional) - conv_state_indices: (batch,) - Indices into conv_state (optional)

Parameters​

  • ​activation (StringSlice[StaticConstantOrigin]): Activation function - "none" or "silu".

Implemented traits​

AnyType, ImplicitlyDestructible

Methods​

execute​

static execute[dtype: DType, target: StringSlice[StaticConstantOrigin]](output: ManagedTensorSlice[Output, static_spec=output.static_spec], conv_state: ManagedTensorSlice[Output, static_spec=conv_state.static_spec], x: ManagedTensorSlice[Input, static_spec=x.static_spec], weight: ManagedTensorSlice[Input, static_spec=weight.static_spec], bias: ManagedTensorSlice[Input, static_spec=bias.static_spec], cache_seqlens: ManagedTensorSlice[Input, static_spec=cache_seqlens.static_spec], conv_state_indices: ManagedTensorSlice[Input, static_spec=conv_state_indices.static_spec], ctx: DeviceContext)

shape​

static shape[dtype: DType](x: ManagedTensorSlice[Input, static_spec=x.static_spec], weight: ManagedTensorSlice[Input, static_spec=weight.static_spec], bias: ManagedTensorSlice[Input, static_spec=bias.static_spec], cache_seqlens: ManagedTensorSlice[Input, static_spec=cache_seqlens.static_spec], conv_state_indices: ManagedTensorSlice[Input, static_spec=conv_state_indices.static_spec]) -> IndexList[3]

Returns:

IndexList[3]