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 function

causal_conv1d_varlen_states_shape

def causal_conv1d_varlen_states_shape[dtype: DType](x: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=x.static_spec], cu_seqlens: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=cu_seqlens.static_spec]) -> IndexList[Int(3)]

Returns the output shape for the causal_conv1d_varlen_states op.

The output is a state buffer with one entry per sequence: shape (batch, dim, state_len). The state_len dimension is determined by the output allocation at runtime; this function returns 0 for that dimension as a placeholder.

Parameters:

  • โ€‹dtype (DType): Element type of the packed input tensor x.

Args:

  • โ€‹x (ManagedTensorSlice[IOSpec[_, _].Input, static_spec=x.static_spec]): Packed input tensor with shape (total_tokens, dim).
  • โ€‹cu_seqlens (ManagedTensorSlice[IOSpec[_, _].Input, static_spec=cu_seqlens.static_spec]): Cumulative sequence lengths with shape (batch + 1,).

Returns:

IndexList[Int(3)]: The output state shape (batch, dim, 0) where batch is inferred from cu_seqlens and state_len is filled at runtime.