ArmNN
 24.08
ITensorHandle Class Referenceabstract

#include <ITensorHandle.hpp>

Inheritance diagram for ITensorHandle:
[legend]

Public Member Functions

virtual ~ITensorHandle ()
 
virtual void Manage ()=0
 Indicate to the memory manager that this resource is active. More...
 
virtual void Allocate ()=0
 Indicate to the memory manager that this resource is no longer active. More...
 
virtual ITensorHandleGetParent () const =0
 Get the parent tensor if this is a subtensor. More...
 
virtual const void * Map (bool blocking=true) const =0
 Map the tensor data for access. More...
 
virtual void Unmap () const =0
 Unmap the tensor data. More...
 
void * Map (bool blocking=true)
 Map the tensor data for access. More...
 
void Unmap ()
 Unmap the tensor data that was previously mapped with call to Map(). More...
 
virtual TensorShape GetStrides () const =0
 Get the strides for each dimension ordered from largest to smallest where the smallest value is the same as the size of a single element in the tensor. More...
 
virtual TensorShape GetShape () const =0
 Get the number of elements for each dimension ordered from slowest iterating dimension to fastest iterating dimension. More...
 
virtual void CopyOutTo (void *memory) const =0
 Testing support to be able to verify and set tensor data content. More...
 
virtual void CopyInFrom (const void *memory)=0
 
virtual unsigned int GetImportFlags () const
 Get flags describing supported import sources. More...
 
virtual bool Import (void *memory, MemorySource source)
 Import externally allocated memory. More...
 
virtual bool CanBeImported (void *memory, MemorySource source)
 Implementations must determine if this memory block can be imported. More...
 
virtual void Unimport ()
 Unimport externally allocated memory. More...
 
virtual std::shared_ptr< ITensorHandleDecorateTensorHandle (const TensorInfo &tensorInfo)
 Returns a decorated version of this TensorHandle allowing us to override the TensorInfo for it. More...
 

Detailed Description

Definition at line 16 of file ITensorHandle.hpp.

Constructor & Destructor Documentation

◆ ~ITensorHandle()

virtual ~ITensorHandle ( )
inlinevirtual

Definition at line 19 of file ITensorHandle.hpp.

19 {}

Member Function Documentation

◆ Allocate()

◆ CanBeImported()

virtual bool CanBeImported ( void *  memory,
MemorySource  source 
)
inlinevirtual

Implementations must determine if this memory block can be imported.

This might be based on alignment or memory source type.

Returns
true if this memory can be imported.
false by default, cannot be imported.

Reimplemented in ClTensorHandle, RefTensorHandleDecorator, NeonTensorHandle, RefTensorHandle, TosaRefTensorHandle, GpuFsaTensorHandle, and ClImportTensorHandle.

Definition at line 86 of file ITensorHandle.hpp.

87  {
88  IgnoreUnused(memory, source);
89  return false;
90  };

References armnn::IgnoreUnused().

◆ CopyInFrom()

virtual void CopyInFrom ( const void *  memory)
pure virtual

Implemented in RefTensorHandleDecorator.

Referenced by CopyDataToITensorHandle().

◆ CopyOutTo()

virtual void CopyOutTo ( void *  memory) const
pure virtual

Testing support to be able to verify and set tensor data content.

Implemented in RefTensorHandleDecorator.

Referenced by CopyDataFromITensorHandle().

◆ DecorateTensorHandle()

virtual std::shared_ptr<ITensorHandle> DecorateTensorHandle ( const TensorInfo tensorInfo)
inlinevirtual

Returns a decorated version of this TensorHandle allowing us to override the TensorInfo for it.

Parameters
tensorInfothe overidden TensorInfo.

Reimplemented in NeonTensorHandle, ClTensorHandle, RefTensorHandleDecorator, RefTensorHandle, NeonTensorHandleDecorator, and NeonSubTensorHandle.

Definition at line 98 of file ITensorHandle.hpp.

99  {
100  IgnoreUnused(tensorInfo);
101  return nullptr;
102  }

References armnn::IgnoreUnused().

◆ GetImportFlags()

virtual unsigned int GetImportFlags ( ) const
inlinevirtual

Get flags describing supported import sources.

Reimplemented in RefTensorHandleDecorator, ClTensorHandle, GpuFsaTensorHandle, NeonTensorHandle, ClImportTensorHandle, RefTensorHandle, TosaRefTensorHandle, and SampleTensorHandle.

Definition at line 70 of file ITensorHandle.hpp.

70 { return 0; }

Referenced by LoadedNetwork::ImportInputs(), and LoadedNetwork::ImportOutputs().

◆ GetParent()

virtual ITensorHandle* GetParent ( ) const
pure virtual

◆ GetShape()

virtual TensorShape GetShape ( ) const
pure virtual

Get the number of elements for each dimension ordered from slowest iterating dimension to fastest iterating dimension.

Returns
a TensorShape filled with the number of elements for each dimension.

Implemented in NeonTensorHandleDecorator, ClTensorHandleDecorator, ClImportSubTensorHandle, NeonSubTensorHandle, ClSubTensorHandle, GpuFsaSubTensorHandle, RefTensorHandleDecorator, ClTensorHandle, GpuFsaTensorHandle, NeonTensorHandle, ClImportTensorHandle, ConstTensorHandle, RefTensorHandle, TosaRefTensorHandle, and SampleTensorHandle.

Referenced by armnn::CopyTensorContentsGeneric(), and armnnUtils::FindMinMax().

◆ GetStrides()

virtual TensorShape GetStrides ( ) const
pure virtual

Get the strides for each dimension ordered from largest to smallest where the smallest value is the same as the size of a single element in the tensor.

Returns
a TensorShape filled with the strides for each dimension

Implemented in NeonTensorHandleDecorator, ClTensorHandleDecorator, ClImportSubTensorHandle, NeonSubTensorHandle, ClSubTensorHandle, GpuFsaSubTensorHandle, RefTensorHandleDecorator, ClTensorHandle, GpuFsaTensorHandle, NeonTensorHandle, ClImportTensorHandle, ConstTensorHandle, RefTensorHandle, TosaRefTensorHandle, and SampleTensorHandle.

Referenced by armnn::CopyTensorContentsGeneric().

◆ Import()

virtual bool Import ( void *  memory,
MemorySource  source 
)
inlinevirtual

Import externally allocated memory.

Parameters
memorybase address of the memory being imported.
sourcesource of the allocation for the memory being imported.
Returns
true on success or false on failure

Reimplemented in NeonTensorHandle, ClTensorHandle, RefTensorHandleDecorator, ClImportTensorHandle, RefTensorHandle, TosaRefTensorHandle, SampleTensorHandle, and GpuFsaTensorHandle.

Definition at line 76 of file ITensorHandle.hpp.

77  {
78  IgnoreUnused(memory, source);
79  return false;
80  };

References armnn::IgnoreUnused().

Referenced by LoadedNetwork::ImportInputs(), and LoadedNetwork::ImportOutputs().

◆ Manage()

virtual void Manage ( )
pure virtual

◆ Map() [1/2]

void* Map ( bool  blocking = true)
inline

Map the tensor data for access.

Must be paired with call to Unmap().

Parameters
blockinghint to block the calling thread until all other accesses are complete. (backend dependent)
Returns
pointer to the first element of the mapped data.

Definition at line 44 of file ITensorHandle.hpp.

45  {
46  return const_cast<void*>(static_cast<const ITensorHandle*>(this)->Map(blocking));
47  }

References ITensorHandle::Map().

◆ Map() [2/2]

◆ Unimport()

virtual void Unimport ( )
inlinevirtual

Unimport externally allocated memory.

Reimplemented in RefTensorHandleDecorator.

Definition at line 93 of file ITensorHandle.hpp.

94  {};

◆ Unmap() [1/2]

void Unmap ( )
inline

Unmap the tensor data that was previously mapped with call to Map().

Definition at line 50 of file ITensorHandle.hpp.

51  {
52  return static_cast<const ITensorHandle*>(this)->Unmap();
53  }

References ITensorHandle::Unmap().

◆ Unmap() [2/2]


The documentation for this class was generated from the following file:
armnn::ITensorHandle::Unmap
virtual void Unmap() const =0
Unmap the tensor data.
armnn::IgnoreUnused
void IgnoreUnused(Ts &&...)
Definition: IgnoreUnused.hpp:14
armnn::ITensorHandle::Map
virtual const void * Map(bool blocking=true) const =0
Map the tensor data for access.