bend-ml-binary-read Releases (2): 0.2.0.0 0x5240900a1da5d0b346237e15fbea87a9 indexed https://jend.leeeet.dev/files.txt?path=bend-ml-binary-read@0.2.0.0 0.1.0.0 0x90859c4c8057ca356750f70618fd2ed4 unindexed https://jend.leeeet.dev/files.txt?path=bend-ml-binary-read@0.1.0.0 Definitions (6): BendMlBinaryRead.read_f32 (https://jend.leeeet.dev/definition.txt?path=bend-ml-binary-read@0.2.0.0/main.bend&name=read_f32) # Reads n numbers (4 * n bytes) at byte `offset` of `file` into cells 0 .. n-1 of `a`, stopping at # a's capacity and at the end of the file. Answers the file, the array and the number of bytes # read, or the error; the file's position does not move. A short read leaves the cells past it as # they were (a last partial number writes only its bytes). def read_f32(file: File, offset: U32, n: U32, a: Array) -> IO(File & (Array & Result<&1, &1, U32 & String, U32>)): BendMlBinaryRead.size64 (https://jend.leeeet.dev/definition.txt?path=bend-ml-binary-read@0.2.0.0/main.bend&name=size64) # The size of `file` in bytes as (hi, lo): hi * 2^32 + lo. Base's File.size fails past 4 GiB. def size64(file: File) -> IO(File & Result<&1, &1, U32 & String, U32 & U32>): BendMlBinaryRead.read_f32_at (https://jend.leeeet.dev/definition.txt?path=bend-ml-binary-read@0.2.0.0/main.bend&name=read_f32_at) # As read_f32, at the byte offset hi * 2^32 + lo, and it answers the number of whole numbers read (not bytes), so a # read of up to 2^32 - 1 numbers (16 GiB) answers its count in a U32. Reads n numbers into cells 0 .. n-1 of `a`, # stopping at a's capacity and at the end of the file; the file's position does not move. A short read leaves the # cells past it as they were, except that a last partial number writes only its bytes, as in read_f32. def read_f32_at(file: File, hi: U32, lo: U32, n: U32, a: Array) -> IO(File & (Array & Result<&1, &1, U32 & String, U32>)): BendMlBinaryRead.read_bf16_at (https://jend.leeeet.dev/definition.txt?path=bend-ml-binary-read@0.2.0.0/main.bend&name=read_bf16_at) # n little-endian BF16 numbers (2 * n bytes) at the byte offset hi * 2^32 + lo, each widened exactly into a cell of # `a`: the F32 whose top 16 bits are the BF16's and whose low 16 bits are zero (what bf16.to(torch.float32) gives). # Stops at a's capacity and at the end of the file, answers the number of whole numbers read, and leaves the cells # past them as they were (a last odd byte is dropped). The file's position does not move. def read_bf16_at(file: File, hi: U32, lo: U32, n: U32, a: Array) -> IO(File & (Array & Result<&1, &1, U32 & String, U32>)): BendMlBinaryRead.read_f32_into (https://jend.leeeet.dev/definition.txt?path=bend-ml-binary-read@0.2.0.0/main.bend&name=read_f32_into) # As read_f32_at, writing cells at .. at + n - 1 of `a` (stopping at a's capacity): one tensor of a file into its place # in a larger array, with no copy. def read_f32_into(file: File, hi: U32, lo: U32, n: U32, a: Array, at: U32) -> IO(File & (Array & Result<&1, &1, U32 & String, U32>)): BendMlBinaryRead.read_bf16_into (https://jend.leeeet.dev/definition.txt?path=bend-ml-binary-read@0.2.0.0/main.bend&name=read_bf16_into) # As read_bf16_at, writing cells at .. at + n - 1 of `a` (stopping at a's capacity). def read_bf16_into(file: File, hi: U32, lo: U32, n: U32, a: Array, at: U32) -> IO(File & (Array & Result<&1, &1, U32 & String, U32>)):