Compute Library
 21.02
ITensorPack Class Reference

Tensor packing service. More...

#include <ITensorPack.h>

Public Member Functions

 ITensorPack ()=default
 Default Constructor. More...
 
void add_tensor (int id, ITensor *tensor)
 Add tensor to the pack. More...
 
void add_tensor (int id, const ITensor *tensor)
 Add const tensor to the pack. More...
 
ITensorget_tensor (int id)
 Get tensor of a given id from the pac. More...
 
const ITensorget_const_tensor (int id) const
 Get constant tensor of a given id. More...
 
size_t size () const
 Pack size accessor. More...
 
bool empty () const
 Checks if pack is empty. More...
 

Detailed Description

Tensor packing service.

Definition at line 37 of file ITensorPack.h.

Constructor & Destructor Documentation

◆ ITensorPack()

ITensorPack ( )
default

Default Constructor.

Member Function Documentation

◆ add_tensor() [1/2]

void add_tensor ( int  id,
ITensor tensor 
)

Add tensor to the pack.

Parameters
[in]idID/type of the tensor to add
[in]tensorTensor to add

Definition at line 30 of file ITensorPack.cpp.

Referenced by NEFill::run(), NEElementwiseUnaryLayer< op >::run(), NEReshapeLayer::run(), NECopy::run(), NEFloor::run(), CpuConcatenate::run(), NEElementwiseMax::run(), ClConcatenate::run(), CLReshapeLayer::run(), NEPermute::run(), NESoftmaxLayerGeneric< IS_LOG >::run(), CLFloor::run(), CLRsqrtLayer::run(), CpuPoolingAssemblyDispatch::run(), CLFill::run(), NEArithmeticSubtraction::run(), CLLogicalNot::run(), CLCopy::run(), NEConcatenateLayer::run(), CLPoolingLayer::run(), NEPoolingLayer::run(), CpuSoftmaxGeneric< IS_LOG >::run(), NEActivationLayer::run(), CLPermute::run(), NEArithmeticAddition::run(), CLActivationLayer::run(), CLCrop::run(), NEPReluLayer::run(), CLConcatenateLayer::run(), CLStridedSlice::run(), CLLogicalAnd::run(), CLLogicalOr::run(), NESlice::run(), CLPReluLayer::run(), NEElementwiseMin::run(), CLExpLayer::run(), NEStridedSlice::run(), CLArithmeticAddition::run(), CLSlice::run(), NEElementwiseSquaredDiff::run(), CLNegLayer::run(), NEPixelWiseMultiplication::run(), CLSinLayer::run(), NEElementwiseDivision::run(), CLArithmeticSubtraction::run(), NEComplexPixelWiseMultiplication::run(), CLPixelWiseMultiplication::run(), CLLogLayer::run(), NEElementwisePower::run(), CLArithmeticDivision::run(), CLAbsLayer::run(), CLComplexPixelWiseMultiplication::run(), NEElementwiseComparison::run(), CLRoundLayer::run(), NEElementwiseComparisonStatic< op >::run(), CLElementwiseMax::run(), CLElementwiseMin::run(), CLElementwiseSquaredDiff::run(), and CLElementwisePower::run().

31 {
32  _pack[id] = PackElement(tensor);
33 }

◆ add_tensor() [2/2]

void add_tensor ( int  id,
const ITensor tensor 
)

Add const tensor to the pack.

Parameters
[in]idID/type of the tensor to add
[in]tensorTensor to add

Definition at line 35 of file ITensorPack.cpp.

36 {
37  _pack[id] = PackElement(tensor);
38 }

◆ empty()

◆ get_const_tensor()

const ITensor * get_const_tensor ( int  id) const

Get constant tensor of a given id.

Parameters
[in]idID of tensor to extract
Returns
The pointer to the tensor if exist and is const else nullptr

Definition at line 40 of file ITensorPack.cpp.

Referenced by CpuConcatenate::run(), ClConcatenate::run(), CpuSoftmaxGeneric< IS_LOG >::run(), ClElementwiseKernel::run_op(), CpuLogits1DMaxKernel::run_op(), CpuReshapeKernel::run_op(), CpuCopyKernel::run_op(), ClReshapeKernel::run_op(), ClFloorKernel::run_op(), ClCopyKernel::run_op(), ClElementWiseUnaryKernel::run_op(), CpuConcatenateHeightKernel::run_op(), CpuConcatenateWidthKernel::run_op(), NELogicalKernel::run_op(), CpuActivationKernel::run_op(), CpuElementwiseKernel::run_op(), CpuPermuteKernel::run_op(), ClWidthConcatenate2TensorsKernel::run_op(), CpuConcatenateBatchKernel::run_op(), ClHeightConcatenateKernel::run_op(), ClWidthConcatenateKernel::run_op(), ClActivationKernel::run_op(), CpuFloorKernel::run_op(), ClPoolingKernel::run_op(), CpuPoolingKernel::run_op(), ClBatchConcatenateKernel::run_op(), ClDepthConcatenateKernel::run_op(), ClFillKernel::run_op(), CpuConcatenateDepthKernel::run_op(), ClWidthConcatenate4TensorsKernel::run_op(), CpuElementwiseUnaryKernel::run_op(), CpuAddKernel::run_op(), CLStridedSliceKernel::run_op(), ClPermuteKernel::run_op(), CpuPoolingAssemblyWrapperKernel::run_op(), CLFillBorderKernel::run_op(), ClCropKernel::run_op(), CpuSubKernel::run_op(), NEStridedSliceKernel::run_op(), CpuLogits1DSoftmaxKernel< IS_LOG >::run_op(), NEPixelWiseMultiplicationKernel::run_op(), CLPixelWiseMultiplicationKernel::run_op(), NEComplexPixelWiseMultiplicationKernel::run_op(), and CLComplexPixelWiseMultiplicationKernel::run_op().

41 {
42  auto it = _pack.find(id);
43  if(it != _pack.end())
44  {
45  return it->second.ctensor != nullptr ? it->second.ctensor : it->second.tensor;
46  }
47  return nullptr;
48 }

◆ get_tensor()

ITensor * get_tensor ( int  id)

Get tensor of a given id from the pac.

Parameters
[in]idID of tensor to extract
Returns
The pointer to the tensor if exist and is non-const else nullptr

Definition at line 50 of file ITensorPack.cpp.

Referenced by CpuConcatenate::run(), ClConcatenate::run(), CpuSoftmaxGeneric< IS_LOG >::run(), CpuFillKernel::run_op(), ClElementwiseKernel::run_op(), CpuLogits1DMaxKernel::run_op(), CpuReshapeKernel::run_op(), CpuCopyKernel::run_op(), ClReshapeKernel::run_op(), ClFloorKernel::run_op(), ClCopyKernel::run_op(), ClElementWiseUnaryKernel::run_op(), CpuConcatenateHeightKernel::run_op(), CpuConcatenateWidthKernel::run_op(), CpuActivationKernel::run_op(), NELogicalKernel::run_op(), CpuElementwiseKernel::run_op(), CpuPermuteKernel::run_op(), ClWidthConcatenate2TensorsKernel::run_op(), CpuConcatenateBatchKernel::run_op(), ClWidthConcatenateKernel::run_op(), ClActivationKernel::run_op(), CpuFloorKernel::run_op(), ClHeightConcatenateKernel::run_op(), ClPoolingKernel::run_op(), CpuPoolingKernel::run_op(), ClBatchConcatenateKernel::run_op(), ClDepthConcatenateKernel::run_op(), ClWidthConcatenate4TensorsKernel::run_op(), CpuConcatenateDepthKernel::run_op(), CpuAddKernel::run_op(), CLStridedSliceKernel::run_op(), CpuElementwiseUnaryKernel::run_op(), ClPermuteKernel::run_op(), NEFillBorderKernel::run_op(), CpuPoolingAssemblyWrapperKernel::run_op(), ClCropKernel::run_op(), CpuSubKernel::run_op(), NEStridedSliceKernel::run_op(), CpuLogits1DSoftmaxKernel< IS_LOG >::run_op(), NEPixelWiseMultiplicationKernel::run_op(), CLPixelWiseMultiplicationKernel::run_op(), NEComplexPixelWiseMultiplicationKernel::run_op(), and CLComplexPixelWiseMultiplicationKernel::run_op().

51 {
52  auto it = _pack.find(id);
53  return it != _pack.end() ? it->second.tensor : nullptr;
54 }

◆ size()

size_t size ( ) const

Pack size accessor.

Returns
Number of tensors registered to the pack

Definition at line 56 of file ITensorPack.cpp.

Referenced by CpuConcatenate::run(), and ClConcatenate::run().

57 {
58  return _pack.size();
59 }

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