def inv_freq.go
import bend-ml-llama@0.2.0.0/main.bend as BendMlLlamaimport Base
389# inv_freq[i] = 1 / (theta ^ (2i / head)), i = 0..half-1 (LlamaRotaryEmbedding, default rope)
390def inv_freq.go(n: Nat, +i: Nat, +theta: F32, +hd: F32) -> List<&2, F32>:
391 match n:
392 case 0n:
393 Nil{}
394 case 1n+p:
395 (1.0 / F32.pow(theta, (F32.from_nat(Nat.mul(2n, i)) / hd : F32)) : F32) <> inv_freq.go(p, 1n+i, theta, hd)