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:
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!