Compute Library
 23.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()

◆ add_tensor() [1/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 }

References tensor.

◆ add_tensor() [2/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.

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

References tensor.

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(), NECopy::run(), NETranspose::run(), CpuSoftmaxGeneric< IS_LOG >::run(), NEElementwiseUnaryLayer< op >::run(), NEFlattenLayer::run(), NEFloor::run(), NEQuantizationLayer::run(), NEConvertFullyConnectedWeights::run(), NEDequantizationLayer::run(), NEPReluLayer::run(), CLReshapeLayer::run(), CLTranspose::run(), NEPermute::run(), CLRsqrtLayer::run(), CLFloor::run(), CLFill::run(), CLLogicalNot::run(), NEElementwiseMax::run(), CpuDirectConv2d::run(), CpuDirectConv3d::run(), CLFlattenLayer::run(), CLCopy::run(), CpuWinogradConv2d::run(), NEScale::run(), NESlice::run(), CLLogicalAnd::run(), CLLogicalOr::run(), NEArithmeticAddition::run(), CLDequantizationLayer::run(), NEMaxUnpoolingLayer::run(), CLConvertFullyConnectedWeights::run(), NEConcatenateLayer::run(), CLPermute::run(), CLPReluLayer::run(), CLConv3D::run(), NEArithmeticSubtraction::run(), CLPooling3dLayer::run(), NEStridedSlice::run(), CLQuantizationLayer::run(), NEActivationLayer::run(), CLPoolingLayer::run(), CLScale::run(), CLDeconvolutionLayer::run(), CLSlice::run(), CLActivationLayer::run(), CLCrop::run(), ClWinogradConv2d::run(), NEDirectConvolutionLayer::run(), CLConcatenateLayer::run(), CLIndirectConvolutionLayer::run(), ClGemmConv2d::run(), CLDirectConvolutionLayer::run(), CLStridedSlice::run(), CpuGemmLowpMatrixMultiplyCore::run(), CLPixelWiseMultiplication::run(), NEPixelWiseMultiplication::run(), CpuGemmConv2d::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().

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

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 }

Referenced by CpuScale::prepare(), CpuDepthwiseConv2dAssemblyDispatch::prepare(), CpuGemmDirectConv2d::prepare(), CpuWinogradConv2d::prepare(), ClFullyConnected::prepare(), ClGemm::prepare(), ClGemmLowpMatrixMultiplyCore::prepare(), ClWinogradConv2d::prepare(), CpuFullyConnected::prepare(), ClGemmConv2d::prepare(), CpuGemmLowpMatrixMultiplyCore::prepare(), CpuGemmConv2d::prepare(), CpuElementwiseBase::run(), CpuElementwiseUnary::run(), ClPRelu::run(), CpuAddMulAdd::run(), ClSoftmax::run(), CpuConcatenate::run(), ClConcatenate::run(), CpuMatMul::run(), CpuSoftmaxGeneric< IS_LOG >::run(), ClGemmLowpOutputStage::run(), CpuDirectConv2d::run(), CpuWinogradConv2d::run(), ClFullyConnected::run(), ClGemm::run(), ClGemmLowpMatrixMultiplyCore::run(), ClWinogradConv2d::run(), CpuFullyConnected::run(), ClGemmConv2d::run(), CpuGemm::run(), CpuGemmLowpMatrixMultiplyCore::run(), CpuGemmConv2d::run(), ClElementwiseKernel::run_op(), CpuElementwiseKernel< CpuArithmeticKernel >::run_op(), CpuConvertQuantizedSignednessKernel::run_op(), CpuDequantizeKernel::run_op(), CpuTransposeKernel::run_op(), CpuCopyKernel::run_op(), CpuReshapeKernel::run_op(), ClDequantizeKernel::run_op(), ClFloorKernel::run_op(), CpuWinogradConv2dTransformInputKernel::run_op(), ClReshapeKernel::run_op(), ClTransposeKernel::run_op(), ClCopyKernel::run_op(), CpuPermuteKernel::run_op(), ClFillKernel::run_op(), ClElementWiseUnaryKernel::run_op(), CpuLogits1DMaxKernel::run_op(), CpuConcatenateBatchKernel::run_op(), ClTransposedConvolutionKernel::run_op(), CpuConcatenateWidthKernel::run_op(), CpuConcatenateHeightKernel::run_op(), CpuQuantizeKernel::run_op(), ClScaleKernel::run_op(), ClWidthConcatenate2TensorsKernel::run_op(), ClWidthConcatenateKernel::run_op(), ClHeightConcatenateKernel::run_op(), ClPool2dKernel::run_op(), ClPool3dKernel::run_op(), ClActivationKernel::run_op(), ClQuantizeKernel::run_op(), NELogicalKernel::run_op(), ClWidthConcatenate4TensorsKernel::run_op(), ClPermuteKernel::run_op(), CpuPool2dKernel::run_op(), ClBatchConcatenateKernel::run_op(), ClDepthConcatenateKernel::run_op(), CpuConvertFullyConnectedWeightsKernel::run_op(), ClMatMulNativeKernel::run_op(), ClConvertFullyConnectedWeightsKernel::run_op(), ClCropKernel::run_op(), CpuConcatenateDepthKernel::run_op(), CpuElementwiseUnaryKernel::run_op(), CpuFloorKernel::run_op(), CpuGemmLowpMatrixAReductionKernel::run_op(), ClMatMulLowpNativeKernel::run_op(), CpuDirectConv2dKernel::run_op(), CpuDirectConv2dOutputStageKernel::run_op(), ClGemmLowpMatrixMultiplyNativeKernel::run_op(), ClGemmReshapeLhsMatrixKernel::run_op(), CpuPool3dKernel::run_op(), CpuGemmLowpMatrixMultiplyKernel::run_op(), ClWinogradFilterTransformKernel::run_op(), ClWinogradInputTransformKernel::run_op(), CpuMaxUnpoolingLayerKernel::run_op(), ClGemmLowpQuantizeDownInt32ScaleByFixedPointKernel::run_op(), CpuActivationKernel::run_op(), CpuScaleKernel::run_op(), CpuSubKernel::run_op(), CpuGemmInterleave4x4Kernel::run_op(), ClIndirectConv2dKernel::run_op(), ClWinogradOutputTransformKernel::run_op(), ClGemmLowpQuantizeDownInt32ScaleKernel::run_op(), ClGemmLowpQuantizeDownInt32ScaleByFloatKernel::run_op(), CpuDirectConv3dKernel::run_op(), CpuAddMulAddKernel::run_op(), ClGemmMatrixMultiplyNativeKernel::run_op(), CpuGemmLowpOffsetContributionKernel::run_op(), CpuGemmLowpQuantizeDownInt32ScaleKernel::run_op(), CpuDepthwiseConv2dNativeKernel::run_op(), ClCastKernel::run_op(), ClGemmMatrixMultiplyReshapedOnlyRhsMMULKernel::run_op(), CpuCol2ImKernel::run_op(), CpuGemmMatrixAdditionKernel::run_op(), CpuGemmLowpQuantizeDownInt32ToInt16ScaleByFixedPointKernel::run_op(), CLStridedSliceKernel::run_op(), ClGemmLowpMatrixMultiplyReshapedKernel::run_op(), CpuCastKernel::run_op(), ClGemmReshapeRhsMatrixKernel::run_op(), CpuGemmLowpQuantizeDownInt32ToInt8ScaleByFixedPointKernel::run_op(), CpuGemmLowpQuantizeDownInt32ToUint8ScaleByFixedPointKernel::run_op(), CpuPool2dAssemblyWrapperKernel::run_op(), CpuAddKernel::run_op(), CpuDepthwiseConv2dAssemblyWrapperKernel::run_op(), CpuGemmMatrixMultiplyKernel::run_op(), CpuMulKernel::run_op(), ClCol2ImKernel::run_op(), ClGemmLowpOffsetContributionKernel::run_op(), ClGemmLowpOffsetContributionOutputStageKernel::run_op(), ClGemmLowpMatrixMultiplyReshapedOnlyRhsMMULKernel::run_op(), ClDirectConv3dKernel::run_op(), ClDirectConv2dKernel::run_op(), ClMatMulNativeMMULKernel::run_op(), CpuWeightsReshapeKernel::run_op(), ClLogits1DMaxShiftExpSumKernel::run_op(), ClMulKernel::run_op(), ClGemmLowpMatrixAReductionKernel::run_op(), ClGemmLowpMatrixMultiplyReshapedOnlyRhsKernel::run_op(), CLFillBorderKernel::run_op(), ClWeightsReshapeKernel::run_op(), CpuWinogradConv2dTransformOutputKernel::run_op(), ClGemmMatrixMultiplyReshapedOnlyRhsKernel::run_op(), CpuGemmTranspose1xWKernel::run_op(), ClIm2ColKernel::run_op(), CpuIm2ColKernel::run_op(), NEStridedSliceKernel::run_op(), ClGemmMatrixMultiplyReshapedKernel::run_op(), CpuGemmLowpOffsetContributionOutputStageKernel::run_op(), CpuLogits1DSoftmaxKernel< IS_LOG >::run_op(), ClLogits1DNormKernel::run_op(), ClComplexMulKernel::run_op(), ClGemmLowpMatrixBReductionKernel::run_op(), CpuGemmLowpMatrixBReductionKernel::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 64 of file ITensorPack.cpp.

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

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

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

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

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

◆ size()

size_t size ( ) const

Pack size accessor.

Returns
Number of tensors registered to the pack

Definition at line 75 of file ITensorPack.cpp.

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

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


The documentation for this class was generated from the following files:
arm_compute::ITensorPack::add_tensor
void add_tensor(int id, ITensor *tensor)
Add tensor to the pack.
Definition: ITensorPack.cpp:39
tensor
CLTensor * tensor
Pointer to the auxiliary tensor.
Definition: ClWorkloadRuntime.cpp:66