Skip to content

npz

fn array #

fn array[T](tensor &vtl.Tensor[T]) NpyArray

array wraps one tensor for a mixed-dtype write_arrays call.

fn members #

fn members(path string) ![]string

members lists the names of .npy arrays in a NumPy .npz archive without the filename suffix. Non-NPY ZIP entries are ignored.

fn read #

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

read loads one named tensor from a NumPy .npz archive. It reads the member bytes directly and never extracts archive paths to the filesystem.

fn write #

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

write stores one or more same-element-type tensors in a NumPy .npz archive. The archive member name is the map key with a .npy suffix appended when it is not already present.

fn write_arrays #

fn write_arrays(path string, arrays map[string]NpyArray) !

write_arrays stores encoded .npy arrays of different element types in one NumPy .npz archive. Build each value with arrayT.

interface NpyArray #

interface NpyArray {
	to_npy() ![]u8
}

NpyArray encodes one tensor as a NumPy .npy payload when the archive is written, so a mixed-dtype write only materializes one member at a time.