def read_bf16_at

bend-ml-binary-read@0.2.0.0 · main.bend:45

import bend-ml-binary-read@0.2.0.0/main.bend as BendMlBinaryRead
import Base

45# n little-endian BF16 numbers (2 * n bytes) at the byte offset hi * 2^32 + lo, each widened exactly into a cell of
46# `a`: the F32 whose top 16 bits are the BF16's and whose low 16 bits are zero (what bf16.to(torch.float32) gives).
47# Stops at a's capacity and at the end of the file, answers the number of whole numbers read, and leaves the cells
48# past them as they were (a last odd byte is dropped). The file's position does not move.
49def read_bf16_at(file: File, hi: U32, lo: U32, n: U32, a: Array<F32>) ->
50  IO(File & (Array<F32> & Result<&1, &1, U32 & String, U32>)):
51  import "./read_at.c"
52  import "./read_at.js"

Uses (8)

Used by (1)