def scores
import bend-ml-llama@0.2.1.0/main.bend as BendMlLlamaimport Base
import bend-ml-tensor-array@0.1.19.0/main.bend as TA
725# q·k for the keys of positions 0..t, oldest first: K (t + 1 rows of `head` numbers) times q, the product
726# Mat.matmul_nt computes for one row (bend-ml-tensor-array's gemm)
727def scores(+hd: Nat, +t: Nat, k: Array<F32>, +q: List<&2, F32>) -> SR:
728 sr_read(t, TA.gemm(1n, 1n+t, hd, U32.from_nat(hd), 1, 1, U32.from_nat(hd), TA.fill_list(q, 0, Array.new(F32, TA.cap_depth(hd), 0.0)), k, Array.new(F32, TA.cap_depth(1n+t), 0.0)))