17#ifndef __ONERT_BACKEND_BUILTIN_TENSOR_REGISTRY_H__
18#define __ONERT_BACKEND_BUILTIN_TENSOR_REGISTRY_H__
54 auto base_tensor = _base_reg->getITensor(ind);
62 auto base_tensor = _base_reg->getNativeITensor(ind);
70 auto base_tensor = _base_reg->getPortableTensor(ind);
78 auto base_tensor = _base_reg->getNativeTensor(ind);
86 return _base_reg->getNativeTensor(ind);
91 auto tensor = _native_io_tensors.find(ind);
92 if (tensor != _native_io_tensors.end())
93 return tensor->second.get();
101 _base_reg->setMigrantTensor(ind, tensor);
109 _base_reg->setNativeTensor(ind, std::move(tensor));
116 _native_io_tensors[ind] = std::move(tensor);
121 return _native_io_tensors;
123 std::shared_ptr<basic::TensorRegistry>
base_reg() {
return _base_reg; }
126 std::shared_ptr<basic::TensorRegistry> _base_reg;
A tensor class that is portable for other backends.
Tensor object that indirects to the tensor it is pointing to.
Tensor registry class for builtin backend.
IOTensor * getNativeIOTensor(const ir::OperandIndex &ind)
void setNativeIOTensor(ir::OperandIndex ind, std::unique_ptr< IOTensor > &&tensor)
bool setMigrantTensor(const ir::OperandIndex &ind, IPortableTensor *tensor) override
Set the Migrant Tensor which are from other backends.
ITensor * getNativeITensor(const ir::OperandIndex &ind) override
Returns pointer of ITensor among native tensors.
Tensor * getNativeOwnTensor(const ir::OperandIndex &ind)
std::shared_ptr< basic::TensorRegistry > base_reg()
ITensor * getITensor(const ir::OperandIndex &ind) override
Returns pointer of ITensor among native and migrant tensors.
IPortableTensor * getNativeTensor(const ir::OperandIndex &ind)
void setNativeOwnTensor(ir::OperandIndex ind, std::unique_ptr< Tensor > &&tensor)
IPortableTensor * getPortableTensor(const ir::OperandIndex &ind)
const ir::OperandIndexMap< std::unique_ptr< IOTensor > > & native_io_tensors()
std::unordered_map< OperandIndex, T > OperandIndexMap