23#include <ElementsKernel/Exception.h>
30using boost::endian::little_uint16_t;
31using boost::endian::little_uint32_t;
41 if (dtype != NpyDtype<T>::str)
44 if (!attr_names.
empty()) {
45 n_elements *= attr_names.
size();
49 input.
read(
reinterpret_cast<char*
>(&data[0]),
sizeof(T) * data.size());
50 return {shape, attr_names,
std::move(data)};
void readNpyHeader(std::istream &input, std::string &dtype, std::vector< size_t > &shape, std::vector< std::string > &attrs, size_t &n_elements)
NdArray< T > readNpy(std::istream &input)