read/write NPY files — xtensor documentation (original) (raw)

Defined in xtensor/io/xnpy.hpp

template<typename T, layout_type L = layout_type::dynamic>
inline auto xt::load_npy(std::istream &stream)

Loads a npy file (the NumPy storage format)

Parameters:

stream – An input stream from which to load the file

Template Parameters:

Returns:

xarray with contents from npy file

template<typename T, layout_type L = layout_type::dynamic>
inline auto xt::load_npy(const std::string &filename)

Loads a npy file (the NumPy storage format)

Parameters:

filename – The filename or path to the file

Template Parameters:

Returns:

xarray with contents from npy file

template<typename E>
inline void xt::dump_npy(const std::string &filename, const xexpression<E> &e)

Save xexpression to NumPy npy format.

Parameters:

template<typename E>
inline std::string xt::dump_npy(const xexpression<E> &e)

Save xexpression to NumPy npy format in a string.

Parameters:

e – the xexpression