Compute Library
 19.08
ITensorAllocator Class Referenceabstract

Interface to allocate tensors. More...

#include <ITensorAllocator.h>

Public Member Functions

 ITensorAllocator ()
 Default constructor. More...
 
 ITensorAllocator (const ITensorAllocator &)=default
 Allow instances of this class to be copy constructed. More...
 
ITensorAllocatoroperator= (const ITensorAllocator &)=default
 Allow instances of this class to be copied. More...
 
 ITensorAllocator (ITensorAllocator &&)=default
 Allow instances of this class to be move constructed. More...
 
ITensorAllocatoroperator= (ITensorAllocator &&)=default
 Allow instances of this class to be moved. More...
 
virtual ~ITensorAllocator ()=default
 Default virtual destructor. More...
 
void init (const TensorInfo &input, size_t alignment=0)
 Initialize a tensor based on the passed TensorInfo. More...
 
TensorInfoinfo ()
 Return a reference to the tensor's metadata. More...
 
const TensorInfoinfo () const
 Return a constant reference to the tensor's metadata. More...
 
size_t alignment () const
 Return underlying's tensor buffer alignment. More...
 
virtual void allocate ()=0
 Interface to be implemented by the child class to allocate the tensor. More...
 
virtual void free ()=0
 Interface to be implemented by the child class to free the allocated tensor. More...
 

Detailed Description

Interface to allocate tensors.

Definition at line 35 of file ITensorAllocator.h.

Constructor & Destructor Documentation

◆ ITensorAllocator() [1/3]

Default constructor.

Definition at line 33 of file ITensorAllocator.cpp.

34  : _info(), _alignment(0)
35 {
36 }

◆ ITensorAllocator() [2/3]

ITensorAllocator ( const ITensorAllocator )
default

Allow instances of this class to be copy constructed.

◆ ITensorAllocator() [3/3]

Allow instances of this class to be move constructed.

◆ ~ITensorAllocator()

virtual ~ITensorAllocator ( )
virtualdefault

Default virtual destructor.

Member Function Documentation

◆ alignment()

size_t alignment ( ) const

Return underlying's tensor buffer alignment.

Returns
Tensor buffer alignment

Definition at line 54 of file ITensorAllocator.cpp.

55 {
56  return _alignment;
57 }

Referenced by TensorAllocator::allocate(), TensorAllocator::import_memory(), ITensorAllocator::init(), and arm_compute::test::validation::TEST_CASE().

◆ allocate()

virtual void allocate ( )
pure virtual

Interface to be implemented by the child class to allocate the tensor.

Note
The child is expected to use the TensorInfo to get the size of the memory allocation.
Warning
The tensor must not already be allocated. Otherwise calling the function will fail.

Implemented in CLTensorAllocator, GCTensorAllocator, and TensorAllocator.

Referenced by GCTensorHandle::allocate(), GCNormalizationLayer::configure(), GCSoftmaxLayer::configure(), GCGEMM::configure(), GCConvolutionLayer::configure(), GCFullyConnectedLayer::prepare(), GCGEMM::prepare(), and GCConvolutionLayer::prepare().

◆ free()

virtual void free ( )
pure virtual

Interface to be implemented by the child class to free the allocated tensor.

Warning
The tensor must have been allocated previously. Otherwise calling the function will fail.

Implemented in CLTensorAllocator, GCTensorAllocator, and TensorAllocator.

Referenced by GCTensorHandle::free(), and GCTensorHandle::release_if_unused().

◆ info() [1/2]

◆ info() [2/2]

const TensorInfo & info ( ) const

Return a constant reference to the tensor's metadata.

Returns
Constant reference to the tensor's metadata.

Definition at line 49 of file ITensorAllocator.cpp.

50 {
51  return _info;
52 }

◆ init()

void init ( const TensorInfo input,
size_t  alignment = 0 
)

Initialize a tensor based on the passed TensorInfo.

Parameters
[in]inputTensorInfo object containing the description of the tensor to initialize.
[in]alignmentAlignment in bytes that the underlying base pointer should comply with.

Definition at line 38 of file ITensorAllocator.cpp.

39 {
40  _info = input;
41  _alignment = alignment;
42 }
size_t alignment() const
Return underlying's tensor buffer alignment.

References ITensorAllocator::alignment().

Referenced by CLTensorHandle::CLTensorHandle(), CLRNNLayer::configure(), CLFFT1D::configure(), GCNormalizationLayer::configure(), CLHOGDescriptor::configure(), GCSoftmaxLayer::configure(), CLHOGGradient::configure(), CLGaussian5x5::configure(), CLSoftmaxLayer::configure(), CLSobel5x5::configure(), CLSobel7x7::configure(), CLCannyEdge::configure(), CLFastCorners::configure(), CLLocallyConnectedLayer::configure(), CLHarrisCorners::configure(), CLHOGMultiDetection::configure(), CLGEMMLowpMatrixMultiplyCore::configure(), CLFFTConvolutionLayer::configure(), CLGenerateProposalsLayer::configure(), CLLSTMLayerQuantized::configure(), CLLSTMLayer::configure(), CLDirectDeconvolutionLayer::configure(), CLGEMMDeconvolutionLayer::configure(), CLFullyConnectedLayer::configure(), GCConvolutionLayer::configure(), CLGEMMConvolutionLayer::configure(), CLDepthwiseConvolutionLayer::configure(), arm_compute::test::create_tensor(), GCTensorHandle::GCTensorHandle(), arm_compute::utils::init_sgemm_output(), and arm_compute::test::validation::TEST_CASE().

◆ operator=() [1/2]

ITensorAllocator& operator= ( const ITensorAllocator )
default

Allow instances of this class to be copied.

Referenced by TensorAllocator::operator=().

◆ operator=() [2/2]

ITensorAllocator& operator= ( ITensorAllocator &&  )
default

Allow instances of this class to be moved.


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