Compute Library
NumPyBinLoader Class Referencefinal

Numpy Binary loader class. More...

#include <GraphUtils.h>

Collaboration diagram for NumPyBinLoader:

Public Member Functions

 NumPyBinLoader (std::string filename, DataLayout file_layout=DataLayout::NCHW)
 Default Constructor. More...
 NumPyBinLoader (NumPyBinLoader &&)=default
 Allows instances to move constructed. More...
bool access_tensor (ITensor &tensor) override
 Interface to be implemented to access a given tensor. More...
- Public Member Functions inherited from ITensorAccessor
virtual ~ITensorAccessor ()=default
 Default virtual destructor. More...

Detailed Description

Numpy Binary loader class.

Definition at line 431 of file GraphUtils.h.

Constructor & Destructor Documentation

◆ NumPyBinLoader() [1/2]

NumPyBinLoader ( std::string  filename,
DataLayout  file_layout = DataLayout::NCHW 

Default Constructor.

[in]filenameBinary file name
[in]file_layout(Optional) Layout of the numpy tensor data. Defaults to NCHW

Definition at line 770 of file GraphUtils.cpp.

771  : _already_loaded(false), _filename(std::move(filename)), _file_layout(file_layout)
772 {
773 }

◆ NumPyBinLoader() [2/2]

NumPyBinLoader ( NumPyBinLoader &&  )

Allows instances to move constructed.

Member Function Documentation

◆ access_tensor()

bool access_tensor ( ITensor tensor)

Interface to be implemented to access a given tensor.

[in]tensorTensor to be accessed
True if access is successful else false

Implements ITensorAccessor.

Definition at line 775 of file GraphUtils.cpp.

References NPYLoader::fill_tensor(), and NPYLoader::open().

Referenced by NumPyAccessor::NumPyAccessor().

776 {
777  if(!_already_loaded)
778  {
779  utils::NPYLoader loader;
780, _file_layout);
781  loader.fill_tensor(tensor);
782  }
784  _already_loaded = !_already_loaded;
785  return _already_loaded;
786 }

The documentation for this class was generated from the following files: