mlx.core.fast.gated_delta_update#
- gated_delta_update(q: array, k: array, v: array, gamma: array, beta: array, initial_state: array | None = None, mask: array | None = None, stream: Stream | ThreadLocalStream | Device | mlx.core.DeviceType | None = None) list[array]#
Gated delta network forward pass.
The number of value heads
Hvmust be a multiple of the number of query and key headsHk.- Parameters:
q (array) – Queries with shape
[B, T, Hk, Dk].k (array) – Keys with shape
[B, T, Hk, Dk].v (array) – Values with shape
[B, T, Hv, Dv].gamma (array) – Decay rates in linear space with shape
[B, T, Hv]or[B, T, Hv, Dk].beta (array) – Delta update rates with shape
[B, T, Hv].initial_state (array, optional) – Initial state with shape
[B, Hv, Dv, Dk]. Default: zeros.mask (array, optional) – Boolean mask with shape
[B, T]. False entries leave the state unchanged and produce zero output. Default:None.
- Returns:
The output with shape
[B, T, Hv, Dv]and the final state with shape[B, Hv, Dv, Dk]and dtypefloat32.- Return type: