Compute Library
 20.08
Tensor Class Reference

Basic implementation of the tensor interface. More...

#include <Tensor.h>

Collaboration diagram for Tensor:
[legend]

Public Member Functions

 Tensor (IRuntimeContext *ctx=nullptr)
 Constructor. More...
 
 ~Tensor ()=default
 Destructor: free the tensor's memory. More...
 
 Tensor (Tensor &&)=default
 Allow instances of this class to be move constructed. More...
 
Tensoroperator= (Tensor &&)=default
 Allow instances of this class to be moved. More...
 
TensorAllocatorallocator ()
 Return a pointer to the tensor's allocator. More...
 
ITensorInfoinfo () const override
 Interface to be implemented by the child class to return the tensor's metadata. More...
 
ITensorInfoinfo () override
 Interface to be implemented by the child class to return the tensor's metadata. More...
 
uint8_t * buffer () const override
 Interface to be implemented by the child class to return a pointer to CPU memory. More...
 
void associate_memory_group (IMemoryGroup *memory_group) override
 Associates a memory managable object with the memory group that manages it. More...
 
- Public Member Functions inherited from ITensor
virtual ~ITensor ()=default
 Default virtual destructor. More...
 
uint8_t * ptr_to_element (const Coordinates &id) const
 Return a pointer to the element at the passed coordinates. More...
 
void copy_from (const ITensor &src)
 Copy the content of another tensor. More...
 
void print (std::ostream &s, IOFormatInfo io_fmt=IOFormatInfo()) const
 Print a tensor to a given stream using user defined formatting information. More...
 
bool is_used () const
 Flags if the tensor is used or not. More...
 
void mark_as_unused () const
 Marks a tensor as unused. More...
 
- Public Member Functions inherited from IMemoryManageable
virtual ~IMemoryManageable ()=default
 Default virtual destructor. More...
 

Detailed Description

Basic implementation of the tensor interface.

Definition at line 37 of file Tensor.h.

Constructor & Destructor Documentation

◆ Tensor() [1/2]

Tensor ( IRuntimeContext ctx = nullptr)

Constructor.

Parameters
[in]ctx(Optional) Pointer to the runtime context.

Definition at line 28 of file Tensor.cpp.

29  : _allocator(this)
30 {
31 }

◆ ~Tensor()

~Tensor ( )
default

Destructor: free the tensor's memory.

◆ Tensor() [2/2]

Tensor ( Tensor &&  )
default

Allow instances of this class to be move constructed.

Member Function Documentation

◆ allocator()

TensorAllocator * allocator ( )

Return a pointer to the tensor's allocator.

Returns
A pointer to the tensor's allocator

Definition at line 48 of file Tensor.cpp.

49 {
50  return &_allocator;
51 }

Referenced by NETensorHandle::allocate(), NEGEMMLowpAssemblyMatrixMultiplyCore::configure(), NEFFT2D::configure(), NEReductionOperation::configure(), NEL2NormalizeLayer::configure(), NEFFT1D::configure(), NEHOGDescriptor::configure(), NEInstanceNormalizationLayer::configure(), NEHOGGradient::configure(), NEGaussian5x5::configure(), NENormalizationLayer::configure(), NERNNLayer::configure(), CPPBoxWithNonMaximaSuppressionLimit::configure(), NESobel5x5::configure(), NESobel7x7::configure(), NEFastCorners::configure(), CPPDetectionPostProcessLayer::configure(), NEScale::configure(), NEDepthwiseConvolutionAssemblyDispatch::configure(), NEDetectionPostProcessLayer::configure(), NEDirectConvolutionLayer::configure(), NEWinogradConvolutionLayer::configure(), NELocallyConnectedLayer::configure(), NECannyEdge::configure(), NEHarrisCorners::configure(), NEHOGMultiDetection::configure(), NEGenerateProposalsLayer::configure(), NEFFTConvolutionLayer::configure(), NEGEMM::configure(), NELSTMLayer::configure(), NEGEMMLowpMatrixMultiplyCore::configure(), NELSTMLayerQuantized::configure(), NEDeconvolutionLayer::configure(), NEQLSTMLayer::configure(), NEGEMMConvolutionLayer::configure(), NETensorHandle::free(), main(), NETensorHandle::NETensorHandle(), NumPyAccessor::NumPyAccessor(), NEWinogradConvolutionLayer::prepare(), NELocallyConnectedLayer::prepare(), NEGEMM::prepare(), NEDepthwiseConvolutionAssemblyDispatch::prepare(), NEFFTConvolutionLayer::prepare(), NEGEMMLowpMatrixMultiplyCore::prepare(), NEDeconvolutionLayer::prepare(), NELSTMLayerQuantized::prepare(), NEFullyConnectedLayer::prepare(), NEGEMMConvolutionLayer::prepare(), NEFullyConnectedLayerReshapeWeightsManaged::release(), NEConvertFullyConnectedWeightsManaged::release(), NEConvolutionLayerReshapeWeightsTransform::release(), NETensorHandle::release_if_unused(), NEFullyConnectedLayerReshapeWeightsManaged::run(), NEConvertFullyConnectedWeightsManaged::run(), NEConvolutionLayerReshapeWeightsTransform::run(), NEFFTConvolutionLayer::run(), and arm_compute::test::validation::TEST_CASE().

◆ associate_memory_group()

void associate_memory_group ( IMemoryGroup memory_group)
overridevirtual

Associates a memory managable object with the memory group that manages it.

Parameters
[in]memory_groupMemory group that manages the object.

Implements IMemoryManageable.

Definition at line 53 of file Tensor.cpp.

54 {
55  _allocator.set_associated_memory_group(memory_group);
56 }
void set_associated_memory_group(IMemoryGroup *associated_memory_group)
Associates the tensor with a memory group.

References TensorAllocator::set_associated_memory_group().

◆ buffer()

uint8_t * buffer ( ) const
overridevirtual

Interface to be implemented by the child class to return a pointer to CPU memory.

Returns
A CPU pointer to the beginning of the image's allocation.

Implements ITensor.

Definition at line 43 of file Tensor.cpp.

44 {
45  return _allocator.data();
46 }
uint8_t * data() const
Returns the pointer to the allocated data.

References TensorAllocator::data().

Referenced by NEFFT1D::configure(), NEDirectConvolutionLayer::configure(), NEFFTConvolutionLayer::configure(), NEDeconvolutionLayer::configure(), main(), NEDepthwiseConvolutionAssemblyDispatch::prepare(), CPPDetectionPostProcessLayer::run(), NEDepthwiseConvolutionAssemblyDispatch::run(), NEFFTConvolutionLayer::run(), NELSTMLayer::run(), and arm_compute::test::validation::TEST_CASE().

◆ info() [1/2]

ITensorInfo * info ( ) const
overridevirtual

Interface to be implemented by the child class to return the tensor's metadata.

Returns
A pointer to the tensor's metadata.

Implements ITensor.

Definition at line 33 of file Tensor.cpp.

34 {
35  return &_allocator.info();
36 }
TensorInfo & info()
Return a reference to the tensor's metadata.

References ITensorAllocator::info().

Referenced by NumPyAccessor::access_tensor(), GCDepthwiseConvolutionLayer3x3Kernel::configure(), NEInstanceNormalizationLayer::configure(), GCConvolutionLayerReshapeWeights::configure(), NEQLSTMLayerNormalizationKernel::configure(), GCDirectConvolutionLayerKernel< kernel_size >::configure(), NERNNLayer::configure(), NEDepthwiseConvolutionLayer3x3Kernel::configure(), CLQLSTMLayerNormalizationKernel::configure(), CLRNNLayer::configure(), NEDirectConvolutionLayerKernel::configure(), CPPDetectionPostProcessLayer::configure(), GCDirectConvolutionLayer::configure(), NEDirectConvolutionLayerOutputStageKernel::configure(), NEDepthwiseConvolutionAssemblyDispatch::configure(), NEDepthwiseConvolutionLayer::configure(), CLDeconvolutionLayer::configure(), NEDepthwiseConvolutionLayerNativeKernel::configure(), NEGEMMLowpQuantizeDownInt32ScaleKernel::configure(), NEConvolutionLayerReshapeWeights::configure(), CLConvolutionLayerReshapeWeights::configure(), NEGEMMLowpQuantizeDownInt32ToInt16ScaleByFixedPointKernel::configure(), NELocallyConnectedLayer::configure(), NEWinogradConvolutionLayer::configure(), NEGEMMLowpQuantizeDownInt32ToInt8ScaleByFixedPointKernel::configure(), NEGEMMLowpQuantizeDownInt32ToUint8ScaleByFixedPointKernel::configure(), CLDepthwiseConvolutionLayer3x3NCHWKernel::configure(), CLGEMMLowpQuantizeDownInt32ScaleKernel::configure(), CLDepthwiseConvolutionLayer3x3NHWCKernel::configure(), CLGEMMLowpQuantizeDownInt32ScaleByFloatKernel::configure(), CLDeconvolutionReshapeOutputKernel::configure(), CLGEMMLowpQuantizeDownInt32ToInt16ScaleByFixedPointKernel::configure(), NEWeightsReshapeKernel::configure(), GCFullyConnectedLayer::configure(), NEGenerateProposalsLayer::configure(), NEFFTConvolutionLayer::configure(), CLGEMMLowpQuantizeDownInt32ToInt8ScaleByFixedPointKernel::configure(), CLGEMMLowpQuantizeDownInt32ToUint8ScaleByFixedPointKernel::configure(), CLDepthwiseConvolutionLayer::configure(), CLGEMMLowpOffsetContributionKernel::configure(), CLLocallyConnectedLayer::configure(), CLWinogradOutputTransformKernel::configure(), NELSTMLayer::configure(), CLDepthwiseConvolutionLayerNativeKernel::configure(), CLDirectConvolutionLayerKernel::configure(), NEGEMMLowpMatrixMultiplyCore::configure(), NEGEMMLowpOffsetContributionOutputStageKernel::configure(), CLGEMMLowpOffsetContributionOutputStageKernel::configure(), CLWinogradConvolutionLayer::configure(), NELSTMLayerQuantized::configure(), NEConvolutionLayer::configure(), NEDeconvolutionLayer::configure(), CLGEMMLowpMatrixMultiplyReshapedOnlyRHSKernel::configure(), CLFFTConvolutionLayer::configure(), GCConvolutionLayer::configure(), CLGEMMDeconvolutionLayer::configure(), CLDirectDeconvolutionLayer::configure(), CLConvolutionLayer::configure(), NEFullyConnectedLayer::configure(), CLFullyConnectedLayer::configure(), NEGEMMConvolutionLayer::configure(), CLGEMMConvolutionLayer::configure(), NEGEMMLowpOutputStage::configure(), arm_compute::graph::backends::detail::create_convolution_layer(), arm_compute::graph::backends::detail::create_convolution_layer< GCConvolutionLayerFunctions, GCTargetInfo >(), arm_compute::graph::backends::detail::create_deconvolution_layer(), arm_compute::graph::backends::detail::create_depthwise_convolution_layer(), arm_compute::graph::backends::detail::create_depthwise_convolution_layer< GCDepthwiseConvolutionLayerFunctions, GCTargetInfo >(), arm_compute::graph::backends::detail::create_fully_connected_layer(), arm_compute::graph::backends::detail::create_fused_convolution_batch_normalization_layer(), arm_compute::graph::backends::detail::create_fused_depthwise_convolution_batch_normalization_layer(), arm_compute::test::validation::DATA_TEST_CASE(), GCScaleKernel::run(), NELSTMLayer::run(), and arm_compute::test::validation::TEST_CASE().

◆ info() [2/2]

ITensorInfo * info ( )
overridevirtual

Interface to be implemented by the child class to return the tensor's metadata.

Returns
A pointer to the tensor's metadata.

Implements ITensor.

Definition at line 38 of file Tensor.cpp.

39 {
40  return &_allocator.info();
41 }
TensorInfo & info()
Return a reference to the tensor's metadata.

References ITensorAllocator::info().

◆ operator=()

Tensor& operator= ( Tensor &&  )
default

Allow instances of this class to be moved.


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