def bv_gemm
import bend-ml-tensor-array@0.1.19.0/main.bend as BendMlTensorArrayimport Base
1666# the rows of one band, one dot product each, with the gemm of Mat.matmul_nt (n = 1), so the
1667# results are identical. Writing the results into an Array and reading them back is faster than
1668# building the list row by row (NOTES.md, exp. 14).
1669def bv_gemm(-r: Nat, +c: Nat, rows: Nat, +rr: Nat, x: Array<F32>, w: Array<F32>) -> BL<r, c>:
1670 match rows:
1671 case 0n:
1672 BL{BLeaf{Mat{w}}, Nil{}}
1673 case 1n+p:
1674 bv_g(r, c, p, gemm(1n, rr, c, U32.from_nat(c), 1, 1, U32.from_nat(c), x, w, Array.new(F32, cap_depth(rr), 0.0)))