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

CausalConv1DVarlenStates

struct CausalConv1DVarlenStates

Extract conv states from variable-length sequences.

Extracts the last state_len elements from each sequence to initialize conv_state for subsequent autoregressive generation.

Tensor Shapes: - states: (batch, dim, state_len) - Output states tensor - x: (total_tokens, dim) - Input tensor (concatenated sequences) - cu_seqlens: (batch + 1,) - Cumulative sequence lengths

Implemented traits​

AnyType, ImplicitlyDestructible

Methods​

execute​

static execute[dtype: DType, target: StringSlice[StaticConstantOrigin]](states: ManagedTensorSlice[Output, static_spec=states.static_spec], x: ManagedTensorSlice[Input, static_spec=x.static_spec], cu_seqlens: ManagedTensorSlice[Input, static_spec=cu_seqlens.static_spec], ctx: DeviceContext)

shape​

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

Returns:

IndexList[3]