Compute Library
 22.08
TensorPackMap Class Reference

Map a kernel (as identified by its unit workload id) to its corresponding tensor pack. More...

#include <ClCompositeOperator.h>

Public Member Functions

ITensorPackfind_tensor_pack (UnitWorkload::Id uwk_id)
 Find a tensor pack associated with the unit workload Id uwk_id. More...
 
ITensorPackget_tensor_pack (UnitWorkload::Id uwk_id)
 Get a tensor pack associated with uwk_id. More...
 
void add_tensor_pack (UnitWorkload::Id uwk_id, const ITensorPack &tensor_pack)
 Add a tensor pack and associate it with unit workload Id uwk_id. More...
 

Detailed Description

Map a kernel (as identified by its unit workload id) to its corresponding tensor pack.

Note
External user should not use the add_tensor_pack method to alter this tensor pack map, and should only use the map returned by bind_tensors
Examples:
dynamic_fusion/cl_fused_conv2d_elementwise_add.cpp.

Definition at line 50 of file ClCompositeOperator.h.

Member Function Documentation

◆ add_tensor_pack()

void add_tensor_pack ( UnitWorkload::Id  uwk_id,
const ITensorPack tensor_pack 
)

Add a tensor pack and associate it with unit workload Id uwk_id.

Note
Should not be used by external user
Parameters
[in]uwk_idunit workload Id associated with the tensor pack
[in]tensor_packTensor Pack to be added

Definition at line 99 of file ClCompositeOperator.cpp.

100 {
101  _tensor_packs[uwk_id] = tensor_pack;
102 }

◆ find_tensor_pack()

ITensorPack * find_tensor_pack ( UnitWorkload::Id  uwk_id)

Find a tensor pack associated with the unit workload Id uwk_id.

Parameters
[in]uwk_idunit workload Id associated with the tensor pack
Returns
ITensorPack*

Definition at line 84 of file ClCompositeOperator.cpp.

85 {
86  auto tensor_pack = _tensor_packs.find(uwk_id);
87  if(tensor_pack != _tensor_packs.end())
88  {
89  return &(tensor_pack->second);
90  }
91  return nullptr;
92 }

◆ get_tensor_pack()

ITensorPack & get_tensor_pack ( UnitWorkload::Id  uwk_id)

Get a tensor pack associated with uwk_id.

Throws a exception if it cannot be found.

Parameters
[in]uwk_idunit workload Id associated with the tensor pack
Returns
ITensorPack*

Definition at line 94 of file ClCompositeOperator.cpp.

Referenced by ClCompositeOperator::prepare(), and ClCompositeOperator::run().

95 {
96  return _tensor_packs.at(uwk_id);
97 }

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