|
libnpy 2.0.0
Lightweight C++ library for reading and writing NPY and NPZ files
|
Class which handles writing of an NPZ archive to disk. More...
#include <npy.h>
Public Member Functions | |
| npzfilewriter (const std::string &path, compression_method_t compression=compression_method_t::STORED, endian_t endianness=npy::endian_t::NATIVE) | |
| Constructor. | |
| npzfilewriter (const char *path, compression_method_t compression=compression_method_t::STORED, endian_t endianness=npy::endian_t::NATIVE) | |
| Constructor. | |
| npzfilewriter (const std::filesystem::path &path, compression_method_t compression=compression_method_t::STORED, endian_t endianness=npy::endian_t::NATIVE) | |
| Constructor. | |
| ~npzfilewriter () | |
| Destructor. This will call npy::npzfilewriter::close, if it has not been called already. | |
| bool | is_open () const |
| Returns whether the NPZ file is open. | |
| void | close () |
| Writes the directory and end-matter of the NPZ file, and closes the file. Further writes will fail. | |
| template<typename T > | |
| void | write (const std::string &filename, const T &tensor) |
| Write a tensor to the NPZ archive. | |
Class which handles writing of an NPZ archive to disk.
| npy::npzfilewriter::npzfilewriter | ( | const std::string & | path, |
| compression_method_t | compression = compression_method_t::STORED, |
||
| endian_t | endianness = npy::endian_t::NATIVE |
||
| ) |
Constructor.
| path | path to the output NPZ file |
| compression | how the entries should be compressed |
| endianness | the endianness to use in writing the entries |
| npy::npzfilewriter::npzfilewriter | ( | const char * | path, |
| compression_method_t | compression = compression_method_t::STORED, |
||
| endian_t | endianness = npy::endian_t::NATIVE |
||
| ) |
Constructor.
| path | path to the output NPZ file |
| compression | how the entries should be compressed |
| endianness | the endianness to use in writing the entries |
| npy::npzfilewriter::npzfilewriter | ( | const std::filesystem::path & | path, |
| compression_method_t | compression = compression_method_t::STORED, |
||
| endian_t | endianness = npy::endian_t::NATIVE |
||
| ) |
Constructor.
| path | path to the output NPZ file |
| compression | how the entries should be compressed |
| endianness | the endianness to use in writing the entries |
| npy::npzfilewriter::~npzfilewriter | ( | ) |
Destructor. This will call npy::npzfilewriter::close, if it has not been called already.
| void npy::npzfilewriter::close | ( | ) |
Writes the directory and end-matter of the NPZ file, and closes the file. Further writes will fail.
| bool npy::npzfilewriter::is_open | ( | ) | const |
Returns whether the NPZ file is open.
|
inline |
Write a tensor to the NPZ archive.
| T | the tensor type |
| filename | the name of the file in the archive |
| tensor | the tensor to write |