ArmNN  NotReleased
ScopedCpuTensorHandle Class Reference

#include <CpuTensorHandle.hpp>

Inheritance diagram for ScopedCpuTensorHandle:
CpuTensorHandle ConstCpuTensorHandle ITensorHandle

Public Member Functions

 ScopedCpuTensorHandle (const TensorInfo &tensorInfo)
 
 ScopedCpuTensorHandle (const ConstTensor &tensor)
 
 ScopedCpuTensorHandle (const ConstCpuTensorHandle &tensorHandle)
 
 ScopedCpuTensorHandle (const ScopedCpuTensorHandle &other)
 
ScopedCpuTensorHandleoperator= (const ScopedCpuTensorHandle &other)
 
 ~ScopedCpuTensorHandle ()
 
virtual void Allocate () override
 
- Public Member Functions inherited from CpuTensorHandle
template<typename T >
T * GetTensor () const
 
template<>
void * GetTensor () const
 
template<>
void * GetTensor () const
 
- Public Member Functions inherited from ConstCpuTensorHandle
template<typename T >
const T * GetConstTensor () const
 
const TensorInfoGetTensorInfo () const
 
virtual void Manage () override
 
virtual ITensorHandleGetParent () const override
 
virtual const void * Map (bool) const override
 
virtual void Unmap () const override
 Unmap the tensor data. More...
 
TensorShape GetStrides () const override
 
TensorShape GetShape () const override
 
template<>
const void * GetConstTensor () const
 
template<>
const void * GetConstTensor () const
 
- Public Member Functions inherited from ITensorHandle
virtual ~ITensorHandle ()
 
void * Map (bool blocking=true)
 
void Unmap ()
 Unmap the tensor data that was previously mapped with call to Map(). More...
 
virtual unsigned int GetImportFlags () const
 Get flags describing supported import sources. More...
 
virtual bool Import (void *memory, MemorySource source)
 

Additional Inherited Members

- Protected Member Functions inherited from CpuTensorHandle
 CpuTensorHandle (const TensorInfo &tensorInfo)
 
void SetMemory (void *mem)
 
- Protected Member Functions inherited from ConstCpuTensorHandle
 ConstCpuTensorHandle (const TensorInfo &tensorInfo)
 
void SetConstMemory (const void *mem)
 

Detailed Description

Definition at line 106 of file CpuTensorHandle.hpp.

Constructor & Destructor Documentation

◆ ScopedCpuTensorHandle() [1/4]

ScopedCpuTensorHandle ( const TensorInfo tensorInfo)
explicit

Definition at line 54 of file CpuTensorHandle.cpp.

55 : CpuTensorHandle(tensorInfo)
56 {
57 }
CpuTensorHandle(const TensorInfo &tensorInfo)

◆ ScopedCpuTensorHandle() [2/4]

ScopedCpuTensorHandle ( const ConstTensor tensor)
explicit

Definition at line 59 of file CpuTensorHandle.cpp.

References BaseTensor< MemoryType >::GetMemoryArea(), and BaseTensor< MemoryType >::GetNumBytes().

60 : ScopedCpuTensorHandle(tensor.GetInfo())
61 {
62  CopyFrom(tensor.GetMemoryArea(), tensor.GetNumBytes());
63 }
ScopedCpuTensorHandle(const TensorInfo &tensorInfo)

◆ ScopedCpuTensorHandle() [3/4]

ScopedCpuTensorHandle ( const ConstCpuTensorHandle tensorHandle)
explicit

Definition at line 65 of file CpuTensorHandle.cpp.

References ConstCpuTensorHandle::GetConstTensor(), TensorInfo::GetNumBytes(), and ConstCpuTensorHandle::GetTensorInfo().

66 : ScopedCpuTensorHandle(tensorHandle.GetTensorInfo())
67 {
68  CopyFrom(tensorHandle.GetConstTensor<void>(), tensorHandle.GetTensorInfo().GetNumBytes());
69 }
ScopedCpuTensorHandle(const TensorInfo &tensorInfo)

◆ ScopedCpuTensorHandle() [4/4]

Definition at line 71 of file CpuTensorHandle.cpp.

72 : CpuTensorHandle(other.GetTensorInfo())
73 {
74  CopyFrom(other);
75 }
CpuTensorHandle(const TensorInfo &tensorInfo)

◆ ~ScopedCpuTensorHandle()

Definition at line 85 of file CpuTensorHandle.cpp.

86 {
87  ::operator delete(GetTensor<void>());
88 }

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.

Implements ITensorHandle.

Definition at line 90 of file CpuTensorHandle.cpp.

References TensorInfo::GetNumBytes(), CpuTensorHandle::GetTensor(), ConstCpuTensorHandle::GetTensorInfo(), and CpuTensorHandle::SetMemory().

91 {
92  if (GetTensor<void>() == nullptr)
93  {
94  SetMemory(::operator new(GetTensorInfo().GetNumBytes()));
95  }
96  else
97  {
98  throw InvalidArgumentException("CpuTensorHandle::Allocate Trying to allocate a CpuTensorHandle"
99  "that already has allocated memory.");
100  }
101 }
const TensorInfo & GetTensorInfo() const
void SetMemory(void *mem)

◆ operator=()

ScopedCpuTensorHandle & operator= ( const ScopedCpuTensorHandle other)

Definition at line 77 of file CpuTensorHandle.cpp.

References CpuTensorHandle::SetMemory().

78 {
79  ::operator delete(GetTensor<void>());
80  SetMemory(nullptr);
81  CopyFrom(other);
82  return *this;
83 }
void SetMemory(void *mem)

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