Compute Library
 21.11
CLAuxTensorHandler Class Reference

#include <ClAuxTensorHandler.h>

Public Member Functions

 CLAuxTensorHandler (int slot_id, TensorInfo &info, ITensorPack &pack, bool pack_inject=false, bool bypass_alloc=false)
 
 CLAuxTensorHandler (TensorInfo &info, ICLTensor &tensor)
 
 CLAuxTensorHandler (const CLAuxTensorHandler &)=delete
 
CLAuxTensorHandleroperator= (const CLAuxTensorHandler)=delete
 
 ~CLAuxTensorHandler ()
 
ICLTensorget ()
 
ICLTensoroperator() ()
 

Detailed Description

Definition at line 39 of file ClAuxTensorHandler.h.

Constructor & Destructor Documentation

◆ CLAuxTensorHandler() [1/3]

CLAuxTensorHandler ( int  slot_id,
TensorInfo info,
ITensorPack pack,
bool  pack_inject = false,
bool  bypass_alloc = false 
)
inline

Definition at line 42 of file ClAuxTensorHandler.h.

References ITensorPack::add_tensor(), CLTensorAllocator::allocate(), CLTensor::allocator(), ARM_COMPUTE_LOG_INFO_WITH_FUNCNAME_ACL, ICLTensor::cl_buffer(), ITensorPack::get_tensor(), CLTensorAllocator::import_memory(), ITensor::info(), arm_compute::test::validation::pack, ITensorAllocator::soft_init(), ITensorInfo::total_size(), and TensorInfo::total_size().

Referenced by CLAuxTensorHandler::CLAuxTensorHandler().

43  : _tensor()
44  {
45  if(info.total_size() == 0)
46  {
47  return;
48  }
49  _tensor.allocator()->soft_init(info);
50 
51  ICLTensor *packed_tensor = utils::cast::polymorphic_downcast<ICLTensor *>(pack.get_tensor(slot_id));
52  if((packed_tensor == nullptr) || (info.total_size() > packed_tensor->info()->total_size()))
53  {
54  if(!bypass_alloc)
55  {
56  _tensor.allocator()->allocate();
57  ARM_COMPUTE_LOG_INFO_WITH_FUNCNAME_ACL("Allocating auxiliary tensor");
58  }
59 
60  if(pack_inject)
61  {
62  pack.add_tensor(slot_id, &_tensor);
63  _injected_tensor_pack = &pack;
64  _injected_slot_id = slot_id;
65  }
66  }
67  else
68  {
69  _tensor.allocator()->import_memory(packed_tensor->cl_buffer());
70  }
71  }
void soft_init(TensorInfo &input, size_t alignment=0)
Initialize a tensor based with a reference TensorInfo.
#define ARM_COMPUTE_LOG_INFO_WITH_FUNCNAME_ACL(msg)
Log an information message to the logger with function name before the message.
Definition: Log.h:99
CLTensorAllocator * allocator()
Return a pointer to the tensor&#39;s allocator.
Definition: CLTensor.cpp:61
Status import_memory(cl::Buffer buffer)
Import an existing memory as a tensor&#39;s backing memory.
void allocate() override
Allocate size specified by TensorInfo of OpenCL memory.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
ITensor * get_tensor(int id)
Get tensor of a given id from the pac.
Definition: ITensorPack.cpp:64
void add_tensor(int id, ITensor *tensor)
Add tensor to the pack.
Definition: ITensorPack.cpp:39

◆ CLAuxTensorHandler() [2/3]

CLAuxTensorHandler ( TensorInfo info,
ICLTensor tensor 
)
inline

Definition at line 73 of file ClAuxTensorHandler.h.

References CLTensor::allocator(), ICLTensor::cl_buffer(), CLAuxTensorHandler::CLAuxTensorHandler(), CLTensorAllocator::import_memory(), ITensor::info(), CLAuxTensorHandler::operator=(), ITensorAllocator::soft_init(), ITensorInfo::total_size(), and TensorInfo::total_size().

74  : _tensor()
75  {
76  _tensor.allocator()->soft_init(info);
77  if(info.total_size() <= tensor.info()->total_size())
78  {
79  _tensor.allocator()->import_memory(tensor.cl_buffer());
80  }
81  }
void soft_init(TensorInfo &input, size_t alignment=0)
Initialize a tensor based with a reference TensorInfo.
CLTensorAllocator * allocator()
Return a pointer to the tensor&#39;s allocator.
Definition: CLTensor.cpp:61
Status import_memory(cl::Buffer buffer)
Import an existing memory as a tensor&#39;s backing memory.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ CLAuxTensorHandler() [3/3]

CLAuxTensorHandler ( const CLAuxTensorHandler )
delete

◆ ~CLAuxTensorHandler()

~CLAuxTensorHandler ( )
inline

Definition at line 86 of file ClAuxTensorHandler.h.

References ITensorPack::remove_tensor().

87  {
88  if(_injected_tensor_pack)
89  {
90  _injected_tensor_pack->remove_tensor(_injected_slot_id);
91  }
92  }
void remove_tensor(int id)
Remove the tensor stored with the given id.
Definition: ITensorPack.cpp:70

Member Function Documentation

◆ get()

◆ operator()()

ICLTensor* operator() ( )
inline

Definition at line 99 of file ClAuxTensorHandler.h.

References arm_compute::ACL_UNKNOWN.

100  {
101  return &_tensor;
102  }

◆ operator=()


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