Compute Library
 21.05
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...
 
void add_const_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_const_tensor()

void add_const_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 40 of file ITensorPack.cpp.

41 {
42  add_tensor(id, tensor);
43 }
void add_tensor(int id, ITensor *tensor)
Add tensor to the pack.
Definition: ITensorPack.cpp:30

References ITensorPack::add_tensor().

◆ 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.

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

Referenced by ITensorPack::add_const_tensor(), TensorPack::add_tensor(), ClPRelu::run(), NEFill::run(), CpuConcatenate::run(), ClConcatenate::run(), NEReshapeLayer::run(), NETranspose::run(), CpuPoolingAssemblyDispatch::run(), NECopy::run(), NEFloor::run(), NEQuantizationLayer::run(), NEElementwiseUnaryLayer< op >::run(), NEConvertFullyConnectedWeights::run(), NEDequantizationLayer::run(), CLReshapeLayer::run(), NEPReluLayer::run(), CLTranspose::run(), NEPermute::run(), CpuSoftmaxGeneric< IS_LOG >::run(), CLRsqrtLayer::run(), NEScale::run(), CLFloor::run(), CLFill::run(), NESoftmaxLayerGeneric< IS_LOG >::run(), CLLogicalNot::run(), NEElementwiseMax::run(), CLCopy::run(), CLDequantizationLayer::run(), NEArithmeticAddition::run(), NEConcatenateLayer::run(), CLPReluLayer::run(), CLPermute::run(), CLPoolingLayer::run(), NEPoolingLayer::run(), CLConvertFullyConnectedWeights::run(), CLQuantizationLayer::run(), NEActivationLayer::run(), NEArithmeticSubtraction::run(), CLScale::run(), CLSoftmaxLayerGeneric< IS_LOG >::run(), CpuDirectConvolution::run(), CLActivationLayer::run(), CLCrop::run(), NEDirectConvolutionLayer::run(), CLConcatenateLayer::run(), CLDirectConvolutionLayer::run(), CLStridedSlice::run(), CLPixelWiseMultiplication::run(), CLLogicalAnd::run(), CLLogicalOr::run(), NEPixelWiseMultiplication::run(), NESlice::run(), CLArithmeticAddition::run(), NEStridedSlice::run(), CLExpLayer::run(), CLSlice::run(), NEElementwiseMin::run(), NEComplexPixelWiseMultiplication::run(), CLComplexPixelWiseMultiplication::run(), CLNegLayer::run(), NEElementwiseSquaredDiff::run(), CLLSTMLayer::run(), CLArithmeticSubtraction::run(), CLSinLayer::run(), NEElementwiseDivision::run(), CLLogLayer::run(), CLArithmeticDivision::run(), NEElementwisePower::run(), CLAbsLayer::run(), NEElementwiseComparison::run(), CLElementwiseMax::run(), CLRoundLayer::run(), NEElementwiseComparisonStatic< op >::run(), CLElementwiseMin::run(), CLElementwiseSquaredDiff::run(), and CLElementwisePower::run().

◆ 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 45 of file ITensorPack.cpp.

46 {
47  auto it = _pack.find(id);
48  if(it != _pack.end())
49  {
50  return it->second.ctensor != nullptr ? it->second.ctensor : it->second.tensor;
51  }
52  return nullptr;
53 }

Referenced by CpuScale::prepare(), CpuDepthwiseConvolutionAssemblyDispatch::prepare(), CpuElementwiseBase::run(), CpuElementwiseUnary::run(), ClPRelu::run(), ClSoftmax::run(), CpuConcatenate::run(), ClConcatenate::run(), CpuSoftmaxGeneric< IS_LOG >::run(), CpuDirectConvolution::run(), ClElementwiseKernel::run_op(), CpuTransposeKernel::run_op(), CpuLogits1DMaxKernel::run_op(), CpuDequantizationKernel::run_op(), CpuReshapeKernel::run_op(), CpuCopyKernel::run_op(), ClTransposeKernel::run_op(), ClFloorKernel::run_op(), ClReshapeKernel::run_op(), ClElementWiseUnaryKernel::run_op(), ClCopyKernel::run_op(), CpuConcatenateHeightKernel::run_op(), CpuConcatenateWidthKernel::run_op(), ClDequantizationKernel::run_op(), CpuPermuteKernel::run_op(), CpuActivationKernel::run_op(), NELogicalKernel::run_op(), CpuElementwiseKernel::run_op(), CpuConcatenateBatchKernel::run_op(), CpuQuantizationKernel::run_op(), ClWidthConcatenate2TensorsKernel::run_op(), ClActivationKernel::run_op(), ClHeightConcatenateKernel::run_op(), ClWidthConcatenateKernel::run_op(), CpuFloorKernel::run_op(), ClPoolingKernel::run_op(), CpuPoolingKernel::run_op(), ClQuantizationKernel::run_op(), ClDepthConcatenateKernel::run_op(), ClFillKernel::run_op(), ClBatchConcatenateKernel::run_op(), CpuConvertFullyConnectedWeightsKernel::run_op(), CpuConcatenateDepthKernel::run_op(), ClPermuteKernel::run_op(), ClWidthConcatenate4TensorsKernel::run_op(), ClConvertFullyConnectedWeightsKernel::run_op(), ClScaleKernel::run_op(), CpuScaleKernel::run_op(), CpuElementwiseUnaryKernel::run_op(), CpuAddKernel::run_op(), CLStridedSliceKernel::run_op(), CpuDirectConvolutionKernel::run_op(), CpuDirectConvolutionOutputStageKernel::run_op(), CpuMulKernel::run_op(), ClMulKernel::run_op(), CpuPoolingAssemblyWrapperKernel::run_op(), CpuDepthwiseConvolutionNativeKernel::run_op(), ClDirectConvolutionKernel::run_op(), CLFillBorderKernel::run_op(), ClCropKernel::run_op(), ClLogits1DMaxShiftExpSumKernel::run_op(), CpuSubKernel::run_op(), NEStridedSliceKernel::run_op(), CpuLogits1DSoftmaxKernel< IS_LOG >::run_op(), ClComplexMulKernel::run_op(), ClLogits1DNormKernel::run_op(), and CpuComplexMulKernel::run_op().

◆ 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 55 of file ITensorPack.cpp.

56 {
57  auto it = _pack.find(id);
58  return it != _pack.end() ? it->second.tensor : nullptr;
59 }

Referenced by TensorPack::get_tensor(), CpuScale::prepare(), CpuDepthwiseConvolutionAssemblyDispatch::prepare(), ClPRelu::run(), ClSoftmax::run(), CpuConcatenate::run(), ClConcatenate::run(), CpuSoftmaxGeneric< IS_LOG >::run(), CpuDepthwiseConvolutionAssemblyDispatch::run(), CpuDirectConvolution::run(), CpuFillKernel::run_op(), ClElementwiseKernel::run_op(), CpuTransposeKernel::run_op(), CpuReshapeKernel::run_op(), CpuLogits1DMaxKernel::run_op(), CpuDequantizationKernel::run_op(), CpuCopyKernel::run_op(), ClTransposeKernel::run_op(), ClFloorKernel::run_op(), ClReshapeKernel::run_op(), ClCopyKernel::run_op(), ClElementWiseUnaryKernel::run_op(), CpuConcatenateWidthKernel::run_op(), CpuConcatenateHeightKernel::run_op(), CpuActivationKernel::run_op(), ClDequantizationKernel::run_op(), CpuPermuteKernel::run_op(), NELogicalKernel::run_op(), CpuElementwiseKernel::run_op(), CpuConcatenateBatchKernel::run_op(), CpuQuantizationKernel::run_op(), ClWidthConcatenate2TensorsKernel::run_op(), CpuFloorKernel::run_op(), ClHeightConcatenateKernel::run_op(), ClWidthConcatenateKernel::run_op(), ClActivationKernel::run_op(), ClPoolingKernel::run_op(), ClQuantizationKernel::run_op(), CpuPoolingKernel::run_op(), ClBatchConcatenateKernel::run_op(), ClDepthConcatenateKernel::run_op(), CpuConvertFullyConnectedWeightsKernel::run_op(), ClPermuteKernel::run_op(), CpuConcatenateDepthKernel::run_op(), ClWidthConcatenate4TensorsKernel::run_op(), ClConvertFullyConnectedWeightsKernel::run_op(), ClScaleKernel::run_op(), CpuScaleKernel::run_op(), CpuElementwiseUnaryKernel::run_op(), CpuAddKernel::run_op(), CpuDirectConvolutionKernel::run_op(), CLStridedSliceKernel::run_op(), CpuDirectConvolutionOutputStageKernel::run_op(), CpuMulKernel::run_op(), NEFillBorderKernel::run_op(), ClMulKernel::run_op(), CpuPoolingAssemblyWrapperKernel::run_op(), CpuDepthwiseConvolutionNativeKernel::run_op(), ClDirectConvolutionKernel::run_op(), ClCropKernel::run_op(), CpuSubKernel::run_op(), ClLogits1DMaxShiftExpSumKernel::run_op(), NEStridedSliceKernel::run_op(), CpuLogits1DSoftmaxKernel< IS_LOG >::run_op(), ClComplexMulKernel::run_op(), ClLogits1DNormKernel::run_op(), and CpuComplexMulKernel::run_op().

◆ size()

size_t size ( ) const

Pack size accessor.

Returns
Number of tensors registered to the pack

Definition at line 61 of file ITensorPack.cpp.

62 {
63  return _pack.size();
64 }

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


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