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

#include <TensorHandle.hpp>

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

Public Member Functions

template<typename T>
T * GetTensor () const
template<>
void * GetTensor () const
template<>
void * GetTensor () const
template<>
void * GetTensor () const
Public Member Functions inherited from ConstTensorHandle
template<typename T>
const T * GetConstTensor () const
const TensorInfoGetTensorInfo () const
virtual void Manage () override
 Indicate to the memory manager that this resource is 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.
template<>
const void * GetConstTensor () const
template<>
const void * GetConstTensor () const
template<>
const void * GetConstTensor () const
Public Member Functions inherited from ITensorHandle
virtual ~ITensorHandle ()
virtual void Allocate ()=0
 Indicate to the memory manager that this resource is no longer active.
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().
virtual unsigned int GetImportFlags () const
 Get flags describing supported import sources.
virtual bool Import (void *memory, MemorySource source)
 Import externally allocated memory.
virtual bool CanBeImported (void *memory, MemorySource source)
 Implementations must determine if this memory block can be imported.
virtual void Unimport ()
 Unimport externally allocated memory.
virtual std::shared_ptr< ITensorHandleDecorateTensorHandle (const TensorInfo &tensorInfo)
 Returns a decorated version of this TensorHandle allowing us to override the TensorInfo for it.

Protected Member Functions

 TensorHandle (const TensorInfo &tensorInfo)
void SetMemory (void *mem)
Protected Member Functions inherited from ConstTensorHandle
 ConstTensorHandle (const TensorInfo &tensorInfo)
void SetConstMemory (const void *mem)

Detailed Description

Definition at line 79 of file TensorHandle.hpp.

Constructor & Destructor Documentation

◆ TensorHandle()

TensorHandle ( const TensorInfo & tensorInfo)
protected

Definition at line 43 of file TensorHandle.cpp.

44: ConstTensorHandle(tensorInfo)
45, m_MutableMemory(nullptr)
46{
47}

References ConstTensorHandle::ConstTensorHandle().

Referenced by PassthroughTensorHandle::PassthroughTensorHandle(), ScopedTensorHandle::ScopedTensorHandle(), and ScopedTensorHandle::ScopedTensorHandle().

Member Function Documentation

◆ GetTensor() [1/4]

template<typename T>
T * GetTensor ( ) const
inline

Definition at line 83 of file TensorHandle.hpp.

84 {
86 {
87 return reinterpret_cast<T*>(m_MutableMemory);
88 }
89 else
90 {
91 throw armnn::Exception("Attempting to get not compatible type tensor!");
92 }
93 }
armnn::TensorInfo GetTensorInfo(unsigned int numberOfBatches, unsigned int numberOfChannels, unsigned int height, unsigned int width, const armnn::DataLayout dataLayout, const armnn::DataType dataType)
bool CompatibleTypes(armnn::DataType)

References armnnUtils::CompatibleTypes(), and ConstTensorHandle::GetTensorInfo().

Referenced by ScopedTensorHandle::Allocate(), ScopedTensorHandle::operator=(), and ScopedTensorHandle::~ScopedTensorHandle().

◆ GetTensor() [2/4]

template<>
void * GetTensor ( ) const

◆ GetTensor() [3/4]

template<>
void * GetTensor ( ) const

◆ GetTensor() [4/4]

template<>
void * GetTensor ( ) const

Definition at line 50 of file TensorHandle.cpp.

51{
52 return m_MutableMemory;
53}

◆ SetMemory()

void SetMemory ( void * mem)
inlineprotected

Definition at line 98 of file TensorHandle.hpp.

99 {
100 m_MutableMemory = mem;
101 SetConstMemory(m_MutableMemory);
102 }

References ConstTensorHandle::SetConstMemory().

Referenced by ScopedTensorHandle::Allocate(), ScopedTensorHandle::operator=(), and PassthroughTensorHandle::PassthroughTensorHandle().


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