Skip to main content

attend_vector

Function attend_vector 

Source
pub fn attend_vector(
    fp: FpUnit,
    q: &[f32],
    keys: &[&[f32]],
    values: &[&[f32]],
    scale: f32,
) -> Vec<f32>
Expand description

One query head’s attention over its cached rows on the vector units: each position’s score the head’s dot with the key times scale, the softmax of the scores, and each value element the probabilities’ dot (fdot, lanes by position) with that element across the positions.