Class handling reading of an NPZ from a file on disk.
More...
#include <npy.h>
|
| | npzfilereader (const std::string &path) |
| | Constructor.
|
| |
| | npzfilereader (const char *path) |
| | Constructor.
|
| |
| | npzfilereader (const std::filesystem::path &path) |
| | Constructor.
|
| |
| bool | is_open () const |
| | Whether the NPZ file is open.
|
| |
| void | close () |
| | Closes the NPZ file.
|
| |
| const std::vector< std::string > & | keys () const |
| | The keys of the tensors in the NPZ.
|
| |
| bool | contains (const std::string &filename) |
| | Returns whether this NPZ contains the specified tensor.
|
| |
| header_info | peek (const std::string &filename) |
| | Returns the header for a specified tensor.
|
| |
| template<typename T > |
| T | read (const std::string &filename) |
| | Read a tensor from the archive.
|
| |
| template<typename T , template< typename > class TENSOR> |
| TENSOR< T > | read (const std::string &filename) |
| | Read a tensor from the archive.
|
| |
Class handling reading of an NPZ from a file on disk.
◆ npzfilereader() [1/3]
| npy::npzfilereader::npzfilereader |
( |
const std::string & |
path | ) |
|
Constructor.
- Parameters
-
| path | path to the input NPZ file |
◆ npzfilereader() [2/3]
| npy::npzfilereader::npzfilereader |
( |
const char * |
path | ) |
|
Constructor.
- Parameters
-
| path | path to the input NPZ file |
◆ npzfilereader() [3/3]
| npy::npzfilereader::npzfilereader |
( |
const std::filesystem::path & |
path | ) |
|
Constructor.
- Parameters
-
| path | path to the input NPZ file |
◆ close()
| void npy::npzfilereader::close |
( |
| ) |
|
◆ contains()
| bool npy::npzfilereader::contains |
( |
const std::string & |
filename | ) |
|
Returns whether this NPZ contains the specified tensor.
- Parameters
-
| filename | the name of the tensor in the archive |
- Returns
- whether the tensor is in the archive
◆ is_open()
| bool npy::npzfilereader::is_open |
( |
| ) |
const |
Whether the NPZ file is open.
◆ keys()
| const std::vector< std::string > & npy::npzfilereader::keys |
( |
| ) |
const |
The keys of the tensors in the NPZ.
◆ peek()
| header_info npy::npzfilereader::peek |
( |
const std::string & |
filename | ) |
|
Returns the header for a specified tensor.
- Parameters
-
| filename | the name of the tensor in the archive |
- Returns
- the header for the tensor
◆ read() [1/2]
template<typename T >
| T npy::npzfilereader::read |
( |
const std::string & |
filename | ) |
|
|
inline |
Read a tensor from the archive.
This method will throw an exception if the tensor does not exist, or if the data type of the tensor does not match the template type.
- Template Parameters
-
- Parameters
-
| filename | the name of the tensor in the archive |
- Returns
- an instance of T read from the archive
◆ read() [2/2]
template<typename T , template< typename > class TENSOR>
| TENSOR< T > npy::npzfilereader::read |
( |
const std::string & |
filename | ) |
|
|
inline |
Read a tensor from the archive.
This method will throw an exception if the tensor does not exist, or if the data type of the tensor does not match the template type.
- Template Parameters
-
| T | the data type |
| TENSOR | the tensor type |
- Parameters
-
| filename | the name of the tensor in the archive |
- Returns
- an instance of TENSOR<T> read from the archive
The documentation for this class was generated from the following file: