Skip to content

npy

fn read #

fn read[T](path string) !&vtl.Tensor[T]

read reads a NumPy .npy v1.0, v2.0, or v3.0 array into T. The file dtype must have the same kind and width as T. Both byte orders and Fortran-order files are converted to VTL's row-major logical tensor layout.

fn read_bytes #

fn read_bytes[T](bytes []u8) !&vtl.Tensor[T]

read_bytes decodes a NumPy .npy v1.0, v2.0, or v3.0 payload into T. The payload's dtype must have the same kind and width as T.

fn to_bytes #

fn to_bytes[T](tensor &vtl.Tensor[T]) ![]u8

to_bytes encodes a CPU tensor as an uncompressed NumPy .npy v1.0 payload.

fn write #

fn write[T](path string, tensor &vtl.Tensor[T]) !

write writes a CPU tensor as an uncompressed NumPy .npy v1.0 file. Numeric primitive types and row-major logical tensor order are supported.