Compute Library
 22.08
ClKernelGraph Struct Reference

#include <ClKernelGraph.h>

Collaboration diagram for ClKernelGraph:
[legend]

Public Types

using Id = DependencyGraph::Id
 
using KernelMap = std::map< Id, utils::memory::deep_unique_ptr< ClKernel > >
 
using KernelTensorMap = std::map< Id, utils::memory::deep_unique_ptr< ClKernelTensor > >
 

Public Member Functions

 ClKernelGraph ()=default
 
 ~ClKernelGraph ()=default
 
Status add_kernel_tensor (ITensorInfo *desc, MemoryType memory_type, const AuxMemoryInfo &memory_info, Id &tensor_id, Id merge_point=DependencyGraph::empty_id())
 
template<typename ContentT , typename KernelDescT >
Status add_kernel (const ClKernelConfig &config, const KernelDescT &desc, const ITensorDescPack< ClKernelTensor > &tensors, Id &kernel_id)
 
ClKernelget_kernel (Id id)
 
const ClKernelget_kernel (Id id) const
 
ClKernelTensorget_tensor (Id id)
 
const ClKernelTensorget_tensor (Id id) const
 

Data Fields

DependencyGraph graph {}
 
KernelMap kernels {}
 
KernelTensorMap tensors {}
 

Friends

bool operator== (const ClKernelGraph &graph0, const ClKernelGraph &graph1)
 

Detailed Description

Definition at line 182 of file ClKernelGraph.h.

Member Typedef Documentation

◆ Id

Definition at line 185 of file ClKernelGraph.h.

◆ KernelMap

Definition at line 186 of file ClKernelGraph.h.

◆ KernelTensorMap

Definition at line 187 of file ClKernelGraph.h.

Constructor & Destructor Documentation

◆ ClKernelGraph()

ClKernelGraph ( )
default

◆ ~ClKernelGraph()

~ClKernelGraph ( )
default

Member Function Documentation

◆ add_kernel()

Status add_kernel ( const ClKernelConfig config,
const KernelDescT &  desc,
const ITensorDescPack< ClKernelTensor > &  tensors,
Id kernel_id 
)
inline

Definition at line 208 of file ClKernelGraph.h.

References ITensorDescPack< TDesc >::get_const_dst_tensors(), ITensorDescPack< TDesc >::get_const_src_tensors(), arm_compute::test::validation::k, and tf_frozen_model_extractor::t.

Referenced by Conv2dContent::translate(), ElementwiseContent::translate(), and FloorContent::translate().

209  {
210  const auto src_tensors = tensors.get_const_src_tensors();
211  const auto dst_tensors = tensors.get_const_dst_tensors();
212  std::vector<Id> src_tensor_ids{};
213  std::vector<Id> dst_tensor_ids{};
214  for(const auto &t : src_tensors)
215  {
216  src_tensor_ids.push_back(t->id);
217  }
218  for(const auto &t : dst_tensors)
219  {
220  dst_tensor_ids.push_back(t->id);
221  }
222  kernel_id = graph.add_operator(src_tensor_ids, dst_tensor_ids).second;
223  auto k = utils::memory::make_deep_unique<ClKernel, ContentT>(this, kernel_id, config, desc, tensors);
224  kernels[kernel_id] = std::move(k);
225  return Status{};
226  }
std::pair< Status, DependencyGraph::Id > add_operator(const std::vector< Id > &inputs, const std::vector< Id > &outputs)
Add a new operator.

◆ add_kernel_tensor()

Status add_kernel_tensor ( ITensorInfo desc,
MemoryType  memory_type,
const AuxMemoryInfo memory_info,
Id tensor_id,
Id  merge_point = DependencyGraph::empty_id() 
)
inline

Definition at line 197 of file ClKernelGraph.h.

198  {
199  tensor_id = graph.add_tensor(merge_point);
200  if(tensors.find(tensor_id) == tensors.end())
201  {
202  tensors[tensor_id] = utils::memory::make_deep_unique<ClKernelTensor, ClKernelTensor>(tensor_id, desc, memory_type, memory_info);
203  }
204  return Status{};
205  }
Id add_tensor(Id merge_tensor=empty_id())
Add a new tensor.

◆ get_kernel() [1/2]

ClKernel* get_kernel ( Id  id)
inline

Definition at line 228 of file ClKernelGraph.h.

229  {
230  return kernels.at(id).get();
231  }

◆ get_kernel() [2/2]

const ClKernel* get_kernel ( Id  id) const
inline

Definition at line 232 of file ClKernelGraph.h.

233  {
234  return kernels.at(id).get();
235  }

◆ get_tensor() [1/2]

◆ get_tensor() [2/2]

const ClKernelTensor* get_tensor ( Id  id) const
inline

Definition at line 241 of file ClKernelGraph.h.

242  {
243  return tensors.at(id).get();
244  }

Friends And Related Function Documentation

◆ operator==

bool operator== ( const ClKernelGraph graph0,
const ClKernelGraph graph1 
)
friend

Definition at line 192 of file ClKernelGraph.h.

193  {
194  return graph0.graph == graph1.graph && graph0.kernels == graph1.kernels && graph0.tensors == graph1.tensors;
195  }

Field Documentation

◆ graph

◆ kernels

KernelMap kernels {}

◆ tensors

KernelTensorMap tensors {}

Definition at line 248 of file ClKernelGraph.h.


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