xnpy: read/write NPY filesΒΆ

Defined in xtensor/xnpy.hpp

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

Loads a npy file (the numpy storage format)

Return
xarray with contents from npy file
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

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

Loads a npy file (the numpy storage format)

Return
xarray with contents from npy file
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

template <typename E>
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>
std::string xt::dump_npy(const xexpression<E> &e)

Save xexpression to NumPy npy format in a string.

Parameters
  • e: the xexpression