Compute Library
 22.08
ClAuxTensorData Class Reference

Holder of any auxiliary CLTensors required by a ClWorkload. More...

#include <ClCompositeOperator.h>

Data Structures

struct  DataView
 A view of a single auxiliary data and the associated TensorInfo and AuxMemoryInfo. More...
 

Public Member Functions

CLTensoradd_aux_tensor (int tensor_id, const ITensorInfo &tensor_info, const AuxMemoryInfo &memory_info)
 Add auxiliary tensor. More...
 
std::vector< DataView > & get_tensors ()
 Get views of all auxiliary tensors. More...
 

Detailed Description

Holder of any auxiliary CLTensors required by a ClWorkload.

Note
The tensors are not allocated by default, and require the user to explicitly allocate them using the TensorInfo and AuxMemoryInfo
This data holder must remain valid until the ClCompositeOperator that it's passed to is out of scope
External user should not use the add_aux_tensor method, and should only use the data returned by bind_tensors
Examples:
dynamic_fusion/cl_fused_conv2d_elementwise_add.cpp.

Definition at line 87 of file ClCompositeOperator.h.

Member Function Documentation

◆ add_aux_tensor()

CLTensor * add_aux_tensor ( int  tensor_id,
const ITensorInfo tensor_info,
const AuxMemoryInfo memory_info 
)

Add auxiliary tensor.

Note
Should not be used by external user
Parameters
[in]tensor_idAny Id that can uniquely identify an auxiliary tensor. Usually ClWorkloadTensor Id
[in]tensor_infoTensorInfo associated with the tensor
[in]memory_infoMemory requirements
Returns
CLTensor* if successfully added, otherwise nullptr

Definition at line 138 of file ClCompositeOperator.cpp.

Referenced by arm_compute::experimental::dynamic_fusion::bind_tensors().

139 {
140  auto find_tensor_pair = _owned_tensors.find(tensor_id);
141  if(find_tensor_pair == _owned_tensors.end())
142  {
143  return find_tensor_pair->second.get();
144  }
145  else
146  {
147  auto tensor = std::make_unique<CLTensor>();
148  auto inserted_pair = _owned_tensors.emplace(tensor_id, std::move(tensor)).first;
149  auto new_tensor = inserted_pair->second.get();
150  _tensors.emplace_back(new_tensor, tensor_info, memory_info);
151  return new_tensor;
152  }
153 }

◆ get_tensors()

std::vector< ClAuxTensorData::DataView > & get_tensors ( )

Get views of all auxiliary tensors.

This is mainly used for allocating the auxiliary tensors.

Returns
std::vector<DataView>&

Definition at line 155 of file ClCompositeOperator.cpp.

156 {
157  return _tensors;
158 }

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