Skip to main content
Log in

Mojo trait

ScoreModTrait

The ScoreMod trait desctribes score_mod for mha kernel like alibi bias.

Implemented traits

AnyType, UnknownDestructibility

Methods

score_mod

score_mod[type: DType, width: Int, //, *, element_type: DType = int32](self: _Self, coord: Index[4, element_type=element_type], score_vec: SIMD[type, width], max_prompt_len: Int = 0) -> SIMD[type, width]

Return score vector at given coordinates given a score_mod.

Arguments: coord is (seq_id, head, q_idx, k_idx) score_vec is at coord of the score matrix

Score_mod calculates a tensor given the functor and adds to score_vec.

Was this page helpful?