24.02.1
|
Numpy data loader. More...
#include <Utils.h>
Public Member Functions | |
NPYLoader () | |
Default constructor. More... | |
void | open (const std::string &npy_filename, DataLayout file_layout=DataLayout::NCHW) |
Open a NPY file and reads its metadata. More... | |
bool | is_open () |
Return true if a NPY file is currently open. More... | |
bool | is_fortran () |
Return true if a NPY file is in fortran order. More... | |
template<typename T > | |
void | init_tensor (T &tensor, arm_compute::DataType dt) |
Initialise the tensor's metadata with the dimensions of the NPY file currently open. More... | |
template<typename T > | |
void | fill_tensor (T &tensor) |
Fill a tensor with the content of the currently open NPY file. More... | |
|
inline |
|
inline |
Fill a tensor with the content of the currently open NPY file.
[in,out] | tensor | Tensor to fill (Must be allocated, and of matching dimensions with the opened NPY). |
Definition at line 365 of file Utils.h.
References ARM_COMPUTE_ERROR, ARM_COMPUTE_ERROR_ON, ARM_COMPUTE_ERROR_ON_DATA_TYPE_NOT_IN, ARM_COMPUTE_ERROR_ON_MSG, ARM_COMPUTE_ERROR_VAR, ARM_COMPUTE_UNUSED, arm_compute::test::validation::dst, arm_compute::mlgo::parser::end(), arm_compute::execute_window_loop(), arm_compute::F16, arm_compute::F32, arm_compute::utils::get_typestring(), NPYLoader::is_open(), arm_compute::utils::map(), arm_compute::NCHW, arm_compute::NHWC, arm_compute::permute(), arm_compute::QASYMM8, arm_compute::S32, Dimensions< T >::set(), TensorShape::set(), tensor, arm_compute::utils::cast::U, arm_compute::utils::unmap(), and Window::use_tensor_dimensions().
Referenced by NumPyBinLoader::access_tensor().
|
inline |
Initialise the tensor's metadata with the dimensions of the NPY file currently open.
[out] | tensor | Tensor to initialise |
[in] | dt | Data type to use for the tensor |
Definition at line 336 of file Utils.h.
References ARM_COMPUTE_ERROR_ON, dt, arm_compute::F32, NPYLoader::is_open(), arm_compute::test::validation::shape, arm_compute::test::validation::src, tensor, and tensor_info.
|
inline |
|
inline |
Return true if a NPY file is currently open.
Definition at line 319 of file Utils.h.
Referenced by NPYLoader::fill_tensor(), NPYLoader::init_tensor(), and NPYLoader::open().
|
inline |
Open a NPY file and reads its metadata.
[in] | npy_filename | File to open |
[in] | file_layout | (Optional) Layout in which the weights are stored in the file. |
Definition at line 298 of file Utils.h.
References ARM_COMPUTE_ERROR_ON, ARM_COMPUTE_ERROR_VAR, ARM_COMPUTE_EXIT_ON_MSG_VAR, arm_compute::mlgo::parser::header(), NPYLoader::is_open(), and arm_compute::utils::parse_npy_header().
Referenced by NumPyBinLoader::access_tensor().