30 if (armnnUtils::CompatibleTypes<T>(
GetTensorInfo().GetDataType()))
32 return reinterpret_cast<const T*
>(m_Memory);
49 virtual const void*
Map(
bool )
const override {
return m_Memory; }
50 virtual void Unmap()
const override {}
65 void CopyOutTo(
void *)
const override {
ARMNN_ASSERT_MSG(
false,
"Unimplemented"); }
66 void CopyInFrom(
const void*)
override {
ARMNN_ASSERT_MSG(
false,
"Unimplemented"); }
71 TensorInfo m_TensorInfo;
76 const void* ConstTensorHandle::GetConstTensor<void>()
const;
85 if (armnnUtils::CompatibleTypes<T>(
GetTensorInfo().GetDataType()))
87 return reinterpret_cast<T*
>(m_MutableMemory);
100 m_MutableMemory = mem;
108 void* m_MutableMemory;
112 void* TensorHandle::GetTensor<void>()
const;
134 void CopyOutTo(
void* memory)
const override;
135 void CopyInFrom(
const void* memory)
override;
138 void CopyFrom(
const void* srcMemory,
unsigned int numBytes);
193 , m_TensorHandle(
std::move(ptr)) {};
196 const void*
Map(
bool blocking =
true)
200 auto pRet = m_TensorHandle->Map(blocking);
232 if (m_Mapped && m_TensorHandle)
234 m_TensorHandle->Unmap();
241 return m_TensorHandle->GetTensorInfo();
251 std::shared_ptr<ConstTensorHandle> m_TensorHandle;
#define ARMNN_ASSERT_MSG(COND, MSG)
ConstPassthroughTensorHandle(const TensorInfo &tensorInfo, const void *mem)
virtual void Allocate() override
Indicate to the memory manager that this resource is no longer active.
ConstTensorHandle(const TensorInfo &tensorInfo)
virtual void Manage() override
Indicate to the memory manager that this resource is active.
const T * GetConstTensor() const
const TensorInfo & GetTensorInfo() const
virtual void Unmap() const override
Unmap the tensor data.
TensorShape GetShape() const override
Get the number of elements for each dimension ordered from slowest iterating dimension to fastest ite...
TensorShape GetStrides() const override
Get the strides for each dimension ordered from largest to smallest where the smallest value is the s...
virtual ITensorHandle * GetParent() const override
Get the parent tensor if this is a subtensor.
virtual const void * Map(bool) const override
Map the tensor data for access.
void SetConstMemory(const void *mem)
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
Base class for all ArmNN exceptions so that users can filter to just those.
ManagedConstTensorHandle & operator=(const ManagedConstTensorHandle &other)=delete
~ManagedConstTensorHandle()
ManagedConstTensorHandle(const ConstTensorHandle &other)=delete
const TensorInfo & GetTensorInfo() const
ManagedConstTensorHandle & operator=(ManagedConstTensorHandle &&other) noexcept=delete
const void * Map(bool blocking=true)
RAII Managed resource Unmaps MemoryArea once out of scope.
ManagedConstTensorHandle(std::shared_ptr< ConstTensorHandle > ptr)
PassthroughTensorHandle(const TensorInfo &tensorInfo, void *mem)
virtual void Allocate() override
Indicate to the memory manager that this resource is no longer active.
virtual void Allocate() override
Indicate to the memory manager that this resource is no longer active.
ScopedTensorHandle(const TensorInfo &tensorInfo)
ScopedTensorHandle & operator=(const ScopedTensorHandle &other)
void SetMemory(void *mem)
TensorHandle(const TensorInfo &tensorInfo)
const TensorShape & GetShape() const
Copyright (c) 2021 ARM Limited and Contributors.
TensorShape GetUnpaddedTensorStrides(const TensorInfo &tensorInfo)