ONE - On-device Neural Engine
|
#include <TrainableTensor.h>
Public Member Functions | |
TrainableTensor ()=delete | |
virtual | ~TrainableTensor ()=default |
TrainableTensor (const ir::OperandInfo &info) | |
void | setBuffer (uint8_t *buffer) |
Set the Buffer object. This method is called for static and non-const tensor. | |
uint8_t * | buffer () const override |
std::vector< ITensor * > | optVars () override |
Get optimizer variables of this trainable tensor. | |
void | appendOptVar (std::unique_ptr< Tensor > opt_var) |
void | setOptVarBuffer (uint8_t *buffer, size_t pos) |
void | fillBuffer (const std::shared_ptr< ir::Data > &data) |
![]() | |
virtual | ~ITrainableTensor ()=default |
IPortableTensor (const ir::OperandInfo &info) | |
![]() | |
IPortableTensor (const ir::OperandInfo &info) | |
virtual | ~IPortableTensor () |
const ir::OperandInfo & | get_info () const |
const ir::Sparsity * | sparsity () const |
size_t | total_size () const override final |
size_t | calcOffset (const ir::Coordinates &coords) const override final |
ir::DataType | data_type () const override final |
float | data_scale () const override final |
int32_t | data_zero_point () const override final |
const std::vector< float > & | data_scales () const override final |
const std::vector< int32_t > & | data_zero_points () const override |
bool | is_constant () const override final |
Return true if the tensor is constant. | |
bool | is_dynamic () const override final |
Return true if the tensor needs dynamic allocation, meaning that during compile-time the outpus shape cannot be known and the output shape is calculated during kernel execution-time. | |
ir::Shape | getShape () const override final |
Get ir::Shape of tensor. | |
bool | has_padding () const final |
void | access (const std::function< void(ITensor &tensor)> &fn) final |
![]() | |
virtual | ~ITensor () |
virtual void | deallocBuffer () |
Dealloc the buffer (only for dynamic tensors) | |
virtual bool | is_subtensor () const |
virtual bool | needMemoryMap () const |
virtual void | enqueueWriteBuffer (const void *, bool) |
virtual void | enqueueReadBuffer (void *, bool) |
Protected Attributes | |
Tensor | _tensor |
std::vector< std::unique_ptr< Tensor > > | _opt_vars |
![]() | |
ir::OperandInfo | _info |
Definition at line 27 of file TrainableTensor.h.
|
delete |
|
virtualdefault |
|
inline |
Definition at line 34 of file TrainableTensor.h.
|
inline |
Definition at line 51 of file TrainableTensor.h.
References _opt_vars.
|
inlineoverridevirtual |
Implements onert::backend::ITensor.
Definition at line 47 of file TrainableTensor.h.
References _tensor, and onert::backend::basic::Tensor::buffer().
Referenced by fillBuffer(), setBuffer(), and setOptVarBuffer().
void onert::backend::basic::train::TrainableTensor::fillBuffer | ( | const std::shared_ptr< ir::Data > & | data | ) |
Definition at line 32 of file TrainableTensor.cc.
References _tensor, onert::backend::basic::Tensor::buffer(), buffer(), and onert::backend::IPortableTensor::total_size().
Referenced by onert::backend::train::BackendContext::gen().
|
overridevirtual |
Get optimizer variables of this trainable tensor.
Implements onert::backend::train::ITrainableTensor.
Definition at line 22 of file TrainableTensor.cc.
References _opt_vars.
|
inline |
Set the Buffer object. This method is called for static and non-const tensor.
Definition at line 44 of file TrainableTensor.h.
References _tensor, buffer(), and onert::backend::basic::Tensor::setBuffer().
|
inline |
|
protected |
Definition at line 64 of file TrainableTensor.h.
Referenced by appendOptVar(), optVars(), and setOptVarBuffer().
|
protected |
Definition at line 63 of file TrainableTensor.h.
Referenced by buffer(), fillBuffer(), and setBuffer().