15 class RefTensorHandleDecorator;
28 virtual void Manage()
override;
37 virtual const void*
Map(
bool )
const override;
40 virtual void Unmap()
const override
67 void CopyOutTo(
void*)
const override;
68 void CopyInFrom(
const void*)
override;
70 void* GetPointer()
const;
77 mutable std::shared_ptr<RefMemoryManager> m_MemoryManager;
79 mutable void* m_UnmanagedMemory;
80 void* m_ImportedMemory;
81 std::vector<std::shared_ptr<RefTensorHandleDecorator>> m_Decorated;
91 virtual void Manage()
override;
100 virtual const void*
Map(
bool )
const override;
131 void*
Map(
bool blocking=
true)
133 return const_cast<void*
>(
static_cast<const ITensorHandle*
>(
this)->
Map(blocking));
virtual const void * Map(bool blocking=true) const =0
Map the tensor data for access.
void * Map(bool blocking=true)
Map the tensor data for access.
void CopyInFrom(const void *) override
const TensorInfo & GetTensorInfo() const
void Unimport() override
Unimport externally allocated memory.
virtual void Allocate() override
Indicate to the memory manager that this resource is no longer active.
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...
virtual std::shared_ptr< ITensorHandle > DecorateTensorHandle(const TensorInfo &tensorInfo) override
Returns a decorated version of this TensorHandle allowing us to override the TensorInfo for it.
TensorShape GetStrides() const override
Get the strides for each dimension ordered from largest to smallest where the smallest value is the s...
~RefTensorHandleDecorator()=default
virtual MemorySourceFlags GetImportFlags() const override
Get flags describing supported import sources.
void CopyOutTo(void *) const override
Testing support to be able to verify and set tensor data content.
RefTensorHandleDecorator(const TensorInfo &tensorInfo, const RefTensorHandle &parent)
virtual bool Import(void *memory, MemorySource source) override
Import externally allocated memory.
void Unmap()
Unmap the tensor data that was previously mapped with call to Map().
virtual ITensorHandle * GetParent() const override
Get the parent tensor if this is a subtensor.
virtual void Manage() override
Indicate to the memory manager that this resource is active.
virtual const void * Map(bool blocking=true) const=0
Map the tensor data for access.
virtual bool CanBeImported(void *memory, MemorySource source) override
Implementations must determine if this memory block can be imported.
RefTensorHandle(const TensorInfo &tensorInfo, std::shared_ptr< RefMemoryManager > &memoryManager)
const TensorInfo & GetTensorInfo() const
virtual void Allocate() override
Indicate to the memory manager that this resource is no longer active.
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...
virtual std::shared_ptr< ITensorHandle > DecorateTensorHandle(const TensorInfo &tensorInfo) override
Returns a decorated version of this TensorHandle allowing us to override the TensorInfo for it.
TensorShape GetStrides() const override
Get the strides for each dimension ordered from largest to smallest where the smallest value is the s...
virtual MemorySourceFlags GetImportFlags() const override
Get flags describing supported import sources.
virtual bool Import(void *memory, MemorySource source) override
Import externally allocated memory.
virtual ITensorHandle * GetParent() const override
Get the parent tensor if this is a subtensor.
virtual void Manage() override
Indicate to the memory manager that this resource is active.
virtual const void * Map(bool blocking=true) const=0
Map the tensor data for access.
virtual bool CanBeImported(void *memory, MemorySource source) override
Implementations must determine if this memory block can be imported.
const TensorShape & GetShape() const
Copyright (c) 2021 ARM Limited and Contributors.
MemorySource
Define the Memory Source to reduce copies.
TensorShape GetUnpaddedTensorStrides(const TensorInfo &tensorInfo)
unsigned int MemorySourceFlags