Compute Library
 21.08
ITensorPack Class Reference

Tensor packing service. More...

#include <ITensorPack.h>

Data Structures

struct  PackElement
 

Public Member Functions

 ITensorPack ()=default
 Default Constructor. More...
 
 ITensorPack (std::initializer_list< PackElement > l)
 Initializer list 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...
 
void remove_tensor (int id)
 Remove the tensor stored with the 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 39 of file ITensorPack.h.

Constructor & Destructor Documentation

◆ ITensorPack() [1/2]

ITensorPack ( )
default

Default Constructor.

◆ ITensorPack() [2/2]

ITensorPack ( std::initializer_list< PackElement l)

Initializer list Constructor.

Definition at line 30 of file ITensorPack.cpp.

31  : _pack()
32 {
33  for(auto &e : l)
34  {
35  _pack[e.id] = e;
36  }
37 }

Member Function Documentation

◆ add_const_tensor()

void add_const_tensor ( int  id,
const ITensor 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 39 of file ITensorPack.cpp.

Referenced by ITensorPack::add_const_tensor(), TensorPack::add_tensor(), CLAuxTensorHandler::CLAuxTensorHandler(), CpuAuxTensorHandler::CpuAuxTensorHandler(), arm_compute::manage_workspace(), ClWinogradConv2d::prepare(), ClPRelu::run(), ClSoftmax::run(), CpuConcatenate::run(), NEFill::run(), ClConcatenate::run(), NEReshapeLayer::run(), NETranspose::run(), NECopy::run(), NEElementwiseUnaryLayer< op >::run(), NEFlattenLayer::run(), NEFloor::run(), NEQuantizationLayer::run(), CpuSoftmaxGeneric< IS_LOG >::run(), NEConvertFullyConnectedWeights::run(), NEDequantizationLayer::run(), CLReshapeLayer::run(), NEPReluLayer::run(), CLTranspose::run(), NEPermute::run(), CLRsqrtLayer::run(), NEScale::run(), CLFill::run(), CLFloor::run(), NEElementwiseMax::run(), CLLogicalNot::run(), CpuDirectConv2d::run(), CLFlattenLayer::run(), CLCopy::run(), NEArithmeticAddition::run(), NESlice::run(), CLLogicalAnd::run(), CLLogicalOr::run(), CLDequantizationLayer::run(), NEConcatenateLayer::run(), CLPermute::run(), CLPReluLayer::run(), CLPoolingLayer::run(), CLConvertFullyConnectedWeights::run(), NEArithmeticSubtraction::run(), NEStridedSlice::run(), CLQuantizationLayer::run(), NEActivationLayer::run(), CLScale::run(), CLSlice::run(), CLActivationLayer::run(), CLCrop::run(), ClWinogradConv2d::run(), NEDirectConvolutionLayer::run(), CLConcatenateLayer::run(), ClGemmConvolution::run(), CLDirectConvolutionLayer::run(), CLStridedSlice::run(), CLPixelWiseMultiplication::run(), CpuGemmLowpMatrixMultiplyCore::run(), CpuGemmConvolution::run(), NEPixelWiseMultiplication::run(), CLArithmeticAddition::run(), CLExpLayer::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().

40 {
41  _pack[id] = PackElement(id, tensor);
42 }

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

45 {
46  _pack[id] = PackElement(id, tensor);
47 }

◆ empty()

bool empty ( ) const

Checks if pack is empty.

Returns
True if empty else false

Definition at line 80 of file ITensorPack.cpp.

Referenced by CLTuner::add_tuning_params(), TensorPack::empty(), CLScheduler::init(), IScheduler::num_threads_hint(), CpuDequantize::run(), CpuQuantize::run(), ClDequantize::run(), ClQuantize::run(), ICLOperator::run(), CpuScale::run(), INEOperator::run(), ClScale::run(), ClPool2d::run(), CpuConcatenate::run(), ClConcatenate::run(), CpuDepthwiseConv2dAssemblyDispatch::run(), CpuPool2d::run(), CpuMul::run(), CpuSoftmaxGeneric< IS_LOG >::run(), CpuComplexMul::run(), CpuActivationKernel::run_op(), NELogicalKernel::run_op(), CpuFloorKernel::run_op(), CpuGemmMatrixAdditionKernel::run_op(), CpuGemmMatrixMultiplyKernel::run_op(), CpuAddKernel::run_op(), CpuGemmInterleave4x4Kernel::run_op(), CpuDepthwiseConv2dAssemblyWrapperKernel::run_op(), CpuGemmLowpQuantizeDownInt32ScaleKernel::run_op(), CpuGemmLowpQuantizeDownInt32ToInt16ScaleByFixedPointKernel::run_op(), CpuPool2dAssemblyWrapperKernel::run_op(), CpuGemmLowpQuantizeDownInt32ToUint8ScaleByFixedPointKernel::run_op(), CpuGemmLowpQuantizeDownInt32ToInt8ScaleByFixedPointKernel::run_op(), CpuGemmTranspose1xWKernel::run_op(), ClIm2ColKernel::run_op(), CpuWinogradConv2dTransformInputKernel< T, OutputTileRows, OutputTileCols, KernelRows, KernelCols >::run_op(), CpuWinogradConv2dTransformOutputKernel< T, OutputTileRows, OutputTileCols, KernelRows, KernelCols >::run_op(), and CpuWinogradConv2dTransformWeightsKernel< T, OutputTileRows, OutputTileCols, KernelRows, KernelCols >::run_op().

81 {
82  return _pack.empty();
83 }

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

Referenced by CpuScale::prepare(), CpuDepthwiseConv2dAssemblyDispatch::prepare(), CpuGemmDirectConv2d::prepare(), CpuWinogradConv2d::prepare(), ClFullyConnected::prepare(), ClGemm::prepare(), CpuFullyConnected::prepare(), ClGemmLowpMatrixMultiplyCore::prepare(), ClWinogradConv2d::prepare(), ClGemmConvolution::prepare(), CpuGemmLowpMatrixMultiplyCore::prepare(), CpuGemmConvolution::prepare(), CpuElementwiseBase::run(), CpuElementwiseUnary::run(), ClPRelu::run(), ClSoftmax::run(), CpuConcatenate::run(), ClConcatenate::run(), CpuSoftmaxGeneric< IS_LOG >::run(), ClGemmLowpOutputStage::run(), CpuDirectConv2d::run(), CpuWinogradConv2d::run(), ClFullyConnected::run(), ClGemm::run(), CpuFullyConnected::run(), ClGemmLowpMatrixMultiplyCore::run(), CpuGemm::run(), ClWinogradConv2d::run(), ClGemmConvolution::run(), CpuGemmLowpMatrixMultiplyCore::run(), CpuGemmConvolution::run(), ClElementwiseKernel::run_op(), CpuElementwiseKernel::run_op(), CpuConvertQuantizedSignednessKernel::run_op(), CpuLogits1DMaxKernel::run_op(), CpuTransposeKernel::run_op(), CpuDequantizeKernel::run_op(), CpuReshapeKernel::run_op(), CpuCopyKernel::run_op(), ClFloorKernel::run_op(), ClReshapeKernel::run_op(), ClTransposeKernel::run_op(), ClDequantizeKernel::run_op(), ClFillKernel::run_op(), CpuConcatenateBatchKernel::run_op(), CpuPermuteKernel::run_op(), ClCopyKernel::run_op(), ClElementWiseUnaryKernel::run_op(), CpuConcatenateHeightKernel::run_op(), CpuConcatenateWidthKernel::run_op(), CpuActivationKernel::run_op(), CpuPool2dKernel::run_op(), CpuQuantizeKernel::run_op(), ClWidthConcatenate2TensorsKernel::run_op(), ClHeightConcatenateKernel::run_op(), ClPool2dKernel::run_op(), ClScaleKernel::run_op(), ClWidthConcatenateKernel::run_op(), ClActivationKernel::run_op(), CpuElementwiseUnaryKernel::run_op(), ClQuantizeKernel::run_op(), NELogicalKernel::run_op(), CpuFloorKernel::run_op(), ClPermuteKernel::run_op(), ClWidthConcatenate4TensorsKernel::run_op(), ClBatchConcatenateKernel::run_op(), CpuConvertFullyConnectedWeightsKernel::run_op(), ClDepthConcatenateKernel::run_op(), CpuDirectConv2dKernel::run_op(), CpuScaleKernel::run_op(), CpuConcatenateDepthKernel::run_op(), ClConvertFullyConnectedWeightsKernel::run_op(), ClCropKernel::run_op(), CpuGemmLowpMatrixAReductionKernel::run_op(), CpuGemmMatrixAdditionKernel::run_op(), CpuGemmMatrixMultiplyKernel::run_op(), CpuDirectConv2dOutputStageKernel::run_op(), CpuAddKernel::run_op(), ClGemmReshapeLhsMatrixKernel::run_op(), CpuSubKernel::run_op(), ClGemmLowpMatrixMultiplyNativeKernel::run_op(), CpuGemmLowpMatrixMultiplyKernel::run_op(), CpuDepthwiseConv2dNativeKernel::run_op(), ClWinogradInputTransformKernel::run_op(), ClWinogradFilterTransformKernel::run_op(), ClGemmLowpQuantizeDownInt32ScaleByFixedPointKernel::run_op(), CpuCastKernel::run_op(), CpuGemmInterleave4x4Kernel::run_op(), ClCastKernel::run_op(), ClGemmLowpQuantizeDownInt32ScaleByFloatKernel::run_op(), ClGemmLowpQuantizeDownInt32ScaleKernel::run_op(), ClWinogradOutputTransformKernel::run_op(), ClGemmMatrixMultiplyNativeKernel::run_op(), CpuGemmLowpOffsetContributionKernel::run_op(), ClGemmMatrixMultiplyKernel::run_op(), CpuDepthwiseConv2dAssemblyWrapperKernel::run_op(), CpuGemmLowpQuantizeDownInt32ScaleKernel::run_op(), ClDirectConv2dKernel::run_op(), CpuGemmLowpQuantizeDownInt32ToInt16ScaleByFixedPointKernel::run_op(), CpuCol2ImKernel::run_op(), CpuPool2dAssemblyWrapperKernel::run_op(), ClGemmReshapeRhsMatrixKernel::run_op(), CLStridedSliceKernel::run_op(), ClGemmLowpMatrixMultiplyReshapedKernel::run_op(), CpuMulKernel::run_op(), CpuGemmLowpQuantizeDownInt32ToUint8ScaleByFixedPointKernel::run_op(), CpuGemmLowpQuantizeDownInt32ToInt8ScaleByFixedPointKernel::run_op(), ClGemmLowpOffsetContributionKernel::run_op(), ClCol2ImKernel::run_op(), ClGemmLowpOffsetContributionOutputStageKernel::run_op(), CpuWeightsReshapeKernel::run_op(), ClLogits1DMaxShiftExpSumKernel::run_op(), ClMulKernel::run_op(), ClGemmLowpMatrixAReductionKernel::run_op(), ClGemmLowpMatrixMultiplyReshapedOnlyRhsKernel::run_op(), ClWeightsReshapeKernel::run_op(), CLFillBorderKernel::run_op(), ClGemmMatrixMultiplyReshapedOnlyRhsKernel::run_op(), CpuGemmTranspose1xWKernel::run_op(), CpuIm2ColKernel::run_op(), ClIm2ColKernel::run_op(), NEStridedSliceKernel::run_op(), CpuLogits1DSoftmaxKernel< IS_LOG >::run_op(), ClGemmMatrixMultiplyReshapedKernel::run_op(), CpuGemmLowpOffsetContributionOutputStageKernel::run_op(), ClLogits1DNormKernel::run_op(), ClComplexMulKernel::run_op(), ClGemmLowpMatrixBReductionKernel::run_op(), CpuGemmLowpMatrixBReductionKernel::run_op(), CpuComplexMulKernel::run_op(), CpuWinogradConv2dTransformInputKernel< T, OutputTileRows, OutputTileCols, KernelRows, KernelCols >::run_op(), CpuWinogradConv2dTransformOutputKernel< T, OutputTileRows, OutputTileCols, KernelRows, KernelCols >::run_op(), and CpuWinogradConv2dTransformWeightsKernel< T, OutputTileRows, OutputTileCols, KernelRows, KernelCols >::run_op().

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

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

Referenced by CLAuxTensorHandler::CLAuxTensorHandler(), CpuAuxTensorHandler::CpuAuxTensorHandler(), TensorPack::get_tensor(), CpuScale::prepare(), CpuDepthwiseConv2dAssemblyDispatch::prepare(), CpuGemmDirectConv2d::prepare(), CpuWinogradConv2d::prepare(), ClGemm::prepare(), ClWinogradConv2d::prepare(), ClGemmConvolution::prepare(), CpuGemmLowpMatrixMultiplyCore::prepare(), ClPRelu::run(), ClSoftmax::run(), CpuConcatenate::run(), ClConcatenate::run(), CpuSoftmaxGeneric< IS_LOG >::run(), ClGemmLowpOutputStage::run(), CpuDirectConv2d::run(), CpuWinogradConv2d::run(), ClGemm::run(), ClGemmLowpMatrixMultiplyCore::run(), CpuGemm::run(), ClWinogradConv2d::run(), ClGemmConvolution::run(), CpuGemmLowpMatrixMultiplyCore::run(), CpuGemmConvolution::run(), CpuFillKernel::run_op(), ClElementwiseKernel::run_op(), CpuElementwiseKernel::run_op(), CpuLogits1DMaxKernel::run_op(), CpuTransposeKernel::run_op(), CpuConvertQuantizedSignednessKernel::run_op(), CpuDequantizeKernel::run_op(), CpuReshapeKernel::run_op(), CpuCopyKernel::run_op(), ClFloorKernel::run_op(), ClReshapeKernel::run_op(), ClTransposeKernel::run_op(), ClDequantizeKernel::run_op(), CpuPermuteKernel::run_op(), ClElementWiseUnaryKernel::run_op(), CpuConcatenateBatchKernel::run_op(), ClCopyKernel::run_op(), CpuConcatenateHeightKernel::run_op(), CpuConcatenateWidthKernel::run_op(), CpuActivationKernel::run_op(), CpuPool2dKernel::run_op(), CpuQuantizeKernel::run_op(), ClWidthConcatenate2TensorsKernel::run_op(), ClHeightConcatenateKernel::run_op(), ClPool2dKernel::run_op(), ClScaleKernel::run_op(), ClWidthConcatenateKernel::run_op(), ClActivationKernel::run_op(), CpuElementwiseUnaryKernel::run_op(), ClQuantizeKernel::run_op(), NELogicalKernel::run_op(), ClPermuteKernel::run_op(), ClWidthConcatenate4TensorsKernel::run_op(), CpuFloorKernel::run_op(), CpuConvertFullyConnectedWeightsKernel::run_op(), ClBatchConcatenateKernel::run_op(), ClDepthConcatenateKernel::run_op(), CpuDirectConv2dKernel::run_op(), CpuScaleKernel::run_op(), CpuConcatenateDepthKernel::run_op(), ClConvertFullyConnectedWeightsKernel::run_op(), ClCropKernel::run_op(), CpuGemmMatrixAdditionKernel::run_op(), CpuGemmLowpMatrixAReductionKernel::run_op(), CpuGemmMatrixMultiplyKernel::run_op(), ClGemmLowpMatrixMultiplyNativeKernel::run_op(), CpuDirectConv2dOutputStageKernel::run_op(), CpuAddKernel::run_op(), CpuSubKernel::run_op(), ClGemmReshapeLhsMatrixKernel::run_op(), CpuGemmLowpMatrixMultiplyKernel::run_op(), ClWinogradInputTransformKernel::run_op(), ClWinogradFilterTransformKernel::run_op(), CpuDepthwiseConv2dNativeKernel::run_op(), ClGemmLowpQuantizeDownInt32ScaleByFixedPointKernel::run_op(), CpuCastKernel::run_op(), CpuGemmInterleave4x4Kernel::run_op(), ClCastKernel::run_op(), ClGemmLowpQuantizeDownInt32ScaleByFloatKernel::run_op(), ClGemmLowpQuantizeDownInt32ScaleKernel::run_op(), ClWinogradOutputTransformKernel::run_op(), ClGemmMatrixMultiplyNativeKernel::run_op(), CpuGemmLowpOffsetContributionKernel::run_op(), ClGemmMatrixMultiplyKernel::run_op(), CpuDepthwiseConv2dAssemblyWrapperKernel::run_op(), CpuGemmLowpQuantizeDownInt32ScaleKernel::run_op(), CpuCol2ImKernel::run_op(), CpuGemmLowpQuantizeDownInt32ToInt16ScaleByFixedPointKernel::run_op(), ClDirectConv2dKernel::run_op(), CLStridedSliceKernel::run_op(), CpuPool2dAssemblyWrapperKernel::run_op(), ClGemmReshapeRhsMatrixKernel::run_op(), ClGemmLowpMatrixMultiplyReshapedKernel::run_op(), CpuGemmLowpQuantizeDownInt32ToUint8ScaleByFixedPointKernel::run_op(), CpuMulKernel::run_op(), CpuGemmLowpQuantizeDownInt32ToInt8ScaleByFixedPointKernel::run_op(), ClGemmLowpOffsetContributionKernel::run_op(), ClCol2ImKernel::run_op(), NEFillBorderKernel::run_op(), ClGemmLowpOffsetContributionOutputStageKernel::run_op(), CpuWeightsReshapeKernel::run_op(), ClLogits1DMaxShiftExpSumKernel::run_op(), ClMulKernel::run_op(), ClGemmLowpMatrixAReductionKernel::run_op(), ClGemmLowpMatrixMultiplyReshapedOnlyRhsKernel::run_op(), ClWeightsReshapeKernel::run_op(), ClGemmMatrixMultiplyReshapedOnlyRhsKernel::run_op(), CpuGemmTranspose1xWKernel::run_op(), CpuIm2ColKernel::run_op(), ClIm2ColKernel::run_op(), NEStridedSliceKernel::run_op(), CpuLogits1DSoftmaxKernel< IS_LOG >::run_op(), ClGemmMatrixMultiplyReshapedKernel::run_op(), CpuGemmLowpOffsetContributionOutputStageKernel::run_op(), ClComplexMulKernel::run_op(), ClLogits1DNormKernel::run_op(), ClGemmLowpMatrixBReductionKernel::run_op(), CpuGemmLowpMatrixBReductionKernel::run_op(), CpuComplexMulKernel::run_op(), CpuWinogradConv2dTransformInputKernel< T, OutputTileRows, OutputTileCols, KernelRows, KernelCols >::run_op(), CpuWinogradConv2dTransformOutputKernel< T, OutputTileRows, OutputTileCols, KernelRows, KernelCols >::run_op(), and CpuWinogradConv2dTransformWeightsKernel< T, OutputTileRows, OutputTileCols, KernelRows, KernelCols >::run_op().

65 {
66  auto it = _pack.find(id);
67  return it != _pack.end() ? it->second.tensor : nullptr;
68 }

◆ remove_tensor()

void remove_tensor ( int  id)

Remove the tensor stored with the given id.

Parameters
[in]idID of tensor to remove

Definition at line 70 of file ITensorPack.cpp.

Referenced by arm_compute::release_prepare_tensors(), ClWinogradConv2d::run(), CLAuxTensorHandler::~CLAuxTensorHandler(), and CpuAuxTensorHandler::~CpuAuxTensorHandler().

71 {
72  _pack.erase(id);
73 }

◆ size()

size_t size ( ) const

Pack size accessor.

Returns
Number of tensors registered to the pack

Definition at line 75 of file ITensorPack.cpp.

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

76 {
77  return _pack.size();
78 }

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