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

CausalConv1DVarlenFwd

struct CausalConv1DVarlenFwd[activation: StringSlice[StaticConstantOrigin]]

Varlen causal 1D convolution forward pass.

Performs causal 1D convolution on variable-length sequences that are concatenated together. Uses cumulative sequence lengths to identify sequence boundaries.

Tensor Shapes: - output: (dim, total_seqlen) - Output tensor - x: (dim, total_seqlen) - Input tensor (concatenated sequences) - weight: (dim, width) - Convolution weights per channel - bias: (dim,) - Per-channel bias - query_start_loc: (batch + 1,) - Cumulative sequence lengths - cache_indices: (batch,) - Indices into conv_states (optional) - has_initial_state: (batch,) - Whether to use initial state (optional) - conv_states: (batch, dim, width - 1) - Conv states (optional, in/out)

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_states: ManagedTensorSlice[Output, static_spec=conv_states.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], query_start_loc: ManagedTensorSlice[Input, static_spec=query_start_loc.static_spec], cache_indices: ManagedTensorSlice[Input, static_spec=cache_indices.static_spec], has_initial_state: ManagedTensorSlice[Input, static_spec=has_initial_state.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], query_start_loc: ManagedTensorSlice[Input, static_spec=query_start_loc.static_spec], cache_indices: ManagedTensorSlice[Input, static_spec=cache_indices.static_spec], has_initial_state: ManagedTensorSlice[Input, static_spec=has_initial_state.static_spec]) -> IndexList[2]

Returns:

IndexList[2]