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:
- T – select the type of the npy file (note: currently there is no dynamic casting if types do not match)
- L – select layout_type::column_major if you stored data in Fortran format
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:
- T – select the type of the npy file (note: currently there is no dynamic casting if types do not match)
- L – select layout_type::column_major if you stored data in Fortran format
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:
- filename – The filename or path to dump the data
- e – the xexpression
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