def read_floats
import bend-ml-llama@0.2.1.0/main.bend as BendMlLlamaimport Base
1450# n F32 numbers (little-endian) from a file (the tests' inputs; the weights are BF16, below)
1451def read_floats(path: String, +n: Nat) -> IO(List<&2, F32>):
1452 do IO<List<&2, F32>>:
1453 f : File <- IO.try(File, File.open(path, "r"))
1454 m : File & Result<&1, &1, U32 & String, List<&2, U32>> <- File.read_at(f, 0, 1048576)
1455 fl : List<&2, F32> <- rf_loop(blocks_of(Nat.mul(n, 4n), 1048576n), 0, 1048576, m, Nil{})
1456 return List.take(&2, F32, fl, n)
Uses (18)
Used by (0)
No other definition uses this definition.