Skip to content

function load_from_npy(tensor<T, Dims> &, Fn &&) tensor

template <typename T, index_t Dims, typename Fn>
npy_decode_result load_from_npy(tensor<T, Dims>& result, Fn&& read_callback)

Loads a tensor from .npy format using a custom read callback.

The read callback must match the signature: bool(void* data, size_t read_size)

Template parameters
T Element type of the tensor.
Dims Number of dimensions.
Fn Read callback type.
Parameters
result Tensor to populate with loaded data.
read_callback Callback used to read binary data.
Returns
Status code indicating success or failure reason.

Defined at base/npy.hpp:421