Function dfdx::numpy::load

source · []
pub fn load<T, P>(path: P, t: &mut T) -> Result<(), NpyError>where
    T: NumpyDtype + NumpyShape + ReadNumbers,
    P: AsRef<Path>,
Expand description

Loads data from a .npy file. This calls read().

This is implemented for an arbitrarily shaped array. See ReadNumbers for how this is done (recursive array traits!).

Currently only implemented for f32 and f64 arrays. To add another base type, you can implement NumpyShape

Example Usage:

use dfdx::numpy;
let mut arr = [[0.0f32; 3]; 2];
numpy::load("test.npy", &mut arr);