gpuLoad (Function)

Signature: gpuLoad(path: string, offset: int, count: int) -> Result<GpuBuffer<float>, Error>

Description: Reads count little-endian IEEE-754 binary32 values starting at a byte offset of a file into a GpuBuffer, widening each exactly. 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, Error>

Example

gpuLoad("gpt2_124M.bin", 1024, 768) ?: toGpu([0.0])
gpuLoad ("gpt2_124M.bin", 1024, 768) ?: toGpu [0.0]