IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /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. /get-started.md).

Mojo function

load_frequencies

def load_frequencies[pairs: Int](frequencies: ImmPointer[Float32, ImmutAnyOrigin], row: Int, first_pair: Int) -> Tuple[SIMD[.float32, pairs], SIMD[.float32, pairs]]

Loads the cosines and sines of consecutive RoPE pairs.

A frequency row holds 32 cosines, then 32 sines.

Parameters:

  • ​pairs (Int): The number of pairs.

Args:

  • ​frequencies (ImmPointer[Float32, ImmutAnyOrigin]): The frequency table, aligned to 4 * pairs bytes.
  • ​row (Int): The offset of the position's row.
  • ​first_pair (Int): The first pair, a multiple of pairs.

Returns:

Tuple[SIMD[.float32, pairs], SIMD[.float32, pairs]]: The cosines and the sines.

def load_frequencies[pairs: Int](frequencies: TileTensor[.float32, Engine=frequencies.Engine, address_space=frequencies.address_space, linear_idx_type=frequencies.linear_idx_type], position: Int, first_pair: Int) -> Tuple[SIMD[.float32, pairs], SIMD[.float32, pairs]]

Loads the cosines and sines of consecutive RoPE pairs from a table.

A frequency row holds 32 cosines, then 32 sines.

Parameters:

  • ​pairs (Int): The number of pairs.

Args:

Returns:

Tuple[SIMD[.float32, pairs], SIMD[.float32, pairs]]: The cosines and the sines.

Was this page helpful?