def get_norm
bend-ml-llama@0.2.1.0 · main.bend:1657
import bend-ml-llama@0.2.1.0/main.bend as BendMlLlama
import Base
1657
1658def get_norm(+dir: String, +st: List<&2, U32>, +t: Nat, +n: Nat) -> IO(List<&2, F32>):
1659 do IO<List<&2, F32>>:
1660 check_span(st_path(dir), st_hi(st, t), st_lo(st, t), n, t)
1661 f : File <- IO.try(File, File.open(st_path(dir), "r"))
1662 m : File & Result<&1, &1, U32 & String, List<&2, U32>> <- File.read_at(f, st_lo(st, t), U32.from_nat(Nat.mul(n, 2n)))
1663 bs : List<&2, U32> <- rb_done(m)
1664 return List.take(&2, F32, bf16s(bs), n)