gpuLoad (Function)
Signature: gpuLoad(path: string, offset: int, count: int) -> Result<GpuBuffer<float32>, Error>
Description: Reads count little-endian IEEE-754 binary32 values starting at a byte offset of a file into a GpuBuffer<float32>, preserving the binary32 words. A missing file or a short read is an Error carrying the operating system's reason.
Parameters
- path (
string): The file to read - offset (
int): The byte offset the first value starts at - count (
int): How many values to read
Returns: Result<GpuBuffer<float32>, Error>
Example
// Supply a file containing little-endian float32 values.
match gpuLoad("weights.bin", 0, 3) {
Success { value } => print("${gpuLength(value)} values")
Error { message } => print(message)
}
// Supply a file containing little-endian float32 values.
match gpuLoad ("weights.bin", 0, 3)
Success value => print "${gpuLength(value)} values"
Error message => print message