ArmNN
 25.11
Loading...
Searching...
No Matches
RefTensorHandleDecorator Class Reference

#include <RefTensorHandle.hpp>

Inheritance diagram for RefTensorHandleDecorator:
[legend]
Collaboration diagram for RefTensorHandleDecorator:
[legend]

Public Member Functions

 RefTensorHandleDecorator (const TensorInfo &tensorInfo, const RefTensorHandle &parent)
 ~RefTensorHandleDecorator ()=default
virtual void Manage () override
 Indicate to the memory manager that this resource is active.
virtual void Allocate () override
 Indicate to the memory manager that this resource is no longer active.
virtual ITensorHandleGetParent () const override
 Get the parent tensor if this is a subtensor.
virtual const void * Map (bool) const override
 Map the tensor data for access.
virtual void Unmap () const override
 Unmap the tensor data.
TensorShape GetStrides () const override
 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.
TensorShape GetShape () const override
 Get the number of elements for each dimension ordered from slowest iterating dimension to fastest iterating dimension.
const TensorInfoGetTensorInfo () const
virtual MemorySourceFlags GetImportFlags () const override
 Get flags describing supported import sources.
virtual bool Import (void *memory, MemorySource source) override
 Import externally allocated memory.
virtual bool CanBeImported (void *memory, MemorySource source) override
 Implementations must determine if this memory block can be imported.
virtual std::shared_ptr< ITensorHandleDecorateTensorHandle (const TensorInfo &tensorInfo) override
 Returns a decorated version of this TensorHandle allowing us to override the TensorInfo for it.
void * Map (bool blocking=true)
 Map the tensor data for access.
void Unmap ()
 Unmap the tensor data that was previously mapped with call to Map().
void CopyOutTo (void *) const override
 Testing support to be able to verify and set tensor data content.
void CopyInFrom (const void *) override
void Unimport () override
 Unimport externally allocated memory.
Public Member Functions inherited from RefTensorHandle
 RefTensorHandle (const TensorInfo &tensorInfo, std::shared_ptr< RefMemoryManager > &memoryManager)
 RefTensorHandle (const TensorInfo &tensorInfo)
 RefTensorHandle (const TensorInfo &tensorInfo, const RefTensorHandle &parent)
 ~RefTensorHandle ()
const TensorInfoGetTensorInfo () const
void * Map (bool blocking=true)
 Map the tensor data for access.
Public Member Functions inherited from ITensorHandle
virtual ~ITensorHandle ()
void * Map (bool blocking=true)
 Map the tensor data for access.
void Unmap ()
 Unmap the tensor data that was previously mapped with call to Map().

Detailed Description

Definition at line 84 of file RefTensorHandle.hpp.

Constructor & Destructor Documentation

◆ RefTensorHandleDecorator()

RefTensorHandleDecorator ( const TensorInfo & tensorInfo,
const RefTensorHandle & parent )

Definition at line 174 of file RefTensorHandle.cpp.

175: RefTensorHandle(tensorInfo)
176, m_TensorInfo(tensorInfo)
177, m_Parent(parent)
178{
179}

References RefTensorHandle::RefTensorHandle().

◆ ~RefTensorHandleDecorator()

Member Function Documentation

◆ Allocate()

void Allocate ( )
overridevirtual

Indicate to the memory manager that this resource is no longer active.

This is used to compute overlapping lifetimes of resources.

Reimplemented from RefTensorHandle.

Definition at line 185 of file RefTensorHandle.cpp.

186{
187}

◆ CanBeImported()

bool CanBeImported ( void * memory,
MemorySource source )
overridevirtual

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 from RefTensorHandle.

Definition at line 204 of file RefTensorHandle.cpp.

205{
206 return false;
207}

◆ CopyInFrom()

void CopyInFrom ( const void * )
inlineoverridevirtual

Reimplemented from RefTensorHandle.

Definition at line 146 of file RefTensorHandle.hpp.

147 {};

◆ CopyOutTo()

void CopyOutTo ( void * ) const
inlineoverridevirtual

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

Reimplemented from RefTensorHandle.

Definition at line 143 of file RefTensorHandle.hpp.

144 {};

◆ DecorateTensorHandle()

std::shared_ptr< ITensorHandle > DecorateTensorHandle ( const TensorInfo & tensorInfo)
overridevirtual

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

Parameters
tensorInfothe overidden TensorInfo.

Reimplemented from RefTensorHandle.

Definition at line 209 of file RefTensorHandle.cpp.

210{
211 return nullptr;
212}

◆ GetImportFlags()

MemorySourceFlags GetImportFlags ( ) const
overridevirtual

Get flags describing supported import sources.

Reimplemented from RefTensorHandle.

Definition at line 194 of file RefTensorHandle.cpp.

195{
196 return static_cast<MemorySourceFlags>(MemorySource::Malloc);
197}
unsigned int MemorySourceFlags

References armnn::Malloc.

◆ GetParent()

virtual ITensorHandle * GetParent ( ) const
inlineoverridevirtual

Get the parent tensor if this is a subtensor.

Returns
a pointer to the parent tensor. Otherwise nullptr if not a subtensor.

Reimplemented from RefTensorHandle.

Definition at line 95 of file RefTensorHandle.hpp.

96 {
97 return nullptr;
98 }

◆ GetShape()

TensorShape GetShape ( ) const
inlineoverridevirtual

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.

Reimplemented from RefTensorHandle.

Definition at line 111 of file RefTensorHandle.hpp.

112 {
113 return m_TensorInfo.GetShape();
114 }

◆ GetStrides()

TensorShape GetStrides ( ) const
inlineoverridevirtual

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

Reimplemented from RefTensorHandle.

Definition at line 106 of file RefTensorHandle.hpp.

107 {
108 return GetUnpaddedTensorStrides(m_TensorInfo);
109 }
TensorShape GetUnpaddedTensorStrides(const TensorInfo &tensorInfo)

References armnn::GetUnpaddedTensorStrides().

◆ GetTensorInfo()

const TensorInfo & GetTensorInfo ( ) const
inline

Definition at line 116 of file RefTensorHandle.hpp.

117 {
118 return m_TensorInfo;
119 }

◆ Import()

bool Import ( void * memory,
MemorySource source )
overridevirtual

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 from RefTensorHandle.

Definition at line 199 of file RefTensorHandle.cpp.

200{
201 return false;
202}

◆ Manage()

void Manage ( )
overridevirtual

Indicate to the memory manager that this resource is active.

This is used to compute overlapping lifetimes of resources.

Reimplemented from RefTensorHandle.

Definition at line 181 of file RefTensorHandle.cpp.

182{
183}

◆ 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 131 of file RefTensorHandle.hpp.

132 {
133 return const_cast<void*>(static_cast<const ITensorHandle*>(this)->Map(blocking));
134 }

References ITensorHandle::Map().

◆ Map() [2/2]

const void * Map ( bool blocking) const
overridevirtual

Map the tensor data for access.

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.

Reimplemented from RefTensorHandle.

Definition at line 189 of file RefTensorHandle.cpp.

190{
191 return m_Parent.Map(unused);
192}

◆ Unimport()

void Unimport ( )
inlineoverridevirtual

Unimport externally allocated memory.

Reimplemented from ITensorHandle.

Definition at line 150 of file RefTensorHandle.hpp.

151 {};

◆ Unmap() [1/2]

void Unmap ( )
inline

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

Definition at line 137 of file RefTensorHandle.hpp.

138 {
139 return static_cast<const ITensorHandle*>(this)->Unmap();
140 }

References Unmap().

◆ Unmap() [2/2]

virtual void Unmap ( ) const
inlineoverridevirtual

Unmap the tensor data.

Reimplemented from RefTensorHandle.

Definition at line 103 of file RefTensorHandle.hpp.

104 {}

Referenced by Unmap().


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