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

GatedDeltaRecurrenceFwd

struct GatedDeltaRecurrenceFwd

Gated DeltaNet recurrence forward pass (Pass 2 of two-pass prefill).

Reads/writes a single mutable recurrent-state pool of shape [max_slots, num_value_heads, key_head_dim, value_head_dim] in place at slot slot_idx[batch_item]. No state-out tensor; the only output is the per-token recurrence output.

Tensor Shapes: - recurrence_output : [total_seq_len, value_dim] (OUT) - qkv_conv_output : [total_seq_len, conv_dim] - decay_per_token : [total_seq_len, num_value_heads] - beta_per_token : [total_seq_len, num_value_heads] - recurrent_state : [max_slots, num_value_heads, KD, VD] (MUT) - slot_idx : [batch_size] uint32 - input_row_offsets : [batch_size + 1] uint32

Implemented traitsโ€‹

AnyType, ImplicitlyDeletable

Methodsโ€‹

executeโ€‹

static def execute[work_dtype: DType, state_dtype: DType, target: StringSlice[ImmStaticOrigin]](recurrence_output: ManagedTensorSlice[IOSpec[_, _].Output, static_spec=recurrence_output.static_spec], qkv_conv_output: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=qkv_conv_output.static_spec], decay_per_token: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=decay_per_token.static_spec], beta_per_token: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=beta_per_token.static_spec], recurrent_state: ManagedTensorSlice[IOSpec[_, _].MutableInput, static_spec=recurrent_state.static_spec], slot_idx: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=slot_idx.static_spec], input_row_offsets: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=input_row_offsets.static_spec], ctx: DeviceContext)

Was this page helpful?