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

CausalConv1DUpdate

struct CausalConv1DUpdate[activation: StringSlice[StaticConstantOrigin]]

Incremental causal conv1d update for autoregressive decoding.

This operation accepts the previous conv_state as an input and produces the updated conv_state as a separate output, compatible with functional graph semantics (no in-place mutation).

Tensor Shapes: Outputs: - output: (batch, channels, seqlen) - Convolution output. - conv_state_out: (batch, channels, state_len) - Updated state. Inputs: - input: (batch, channels, seqlen) - New input tokens. - conv_state_in: (batch, channels, state_len) - Previous state. - weight: (channels, width) - Convolution weights. - bias: (channels,) - Per-channel bias.

Parameters​

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

Implemented traits​

AnyType, ImplicitlyDestructible

Methods​

execute​

static execute[dtype: DType, rank: Int, target: StringSlice[StaticConstantOrigin]](output: ManagedTensorSlice[Output, static_spec=output.static_spec], conv_state: ManagedTensorSlice[Output, static_spec=conv_state.static_spec], input: ManagedTensorSlice[Input, static_spec=input.static_spec], conv_state_in: ManagedTensorSlice[Input, static_spec=conv_state_in.static_spec], weight: ManagedTensorSlice[Input, static_spec=weight.static_spec], bias: ManagedTensorSlice[Input, static_spec=bias.static_spec], ctx: DeviceContext)

shape​

static shape[dtype: DType, rank: Int](input: ManagedTensorSlice[Input, static_spec=input.static_spec], conv_state_in: ManagedTensorSlice[Input, static_spec=conv_state_in.static_spec], weight: ManagedTensorSlice[Input, static_spec=weight.static_spec], bias: ManagedTensorSlice[Input, static_spec=bias.static_spec]) -> Tuple[IndexList[rank], IndexList[rank]]

Returns:

Tuple[IndexList[rank], IndexList[rank]]