17 #include <boost/assert.hpp> 33 BOOST_ASSERT(CompatibleTypes<T>(
GetTensorInfo().GetDataType()));
34 return reinterpret_cast<const T*
>(m_Memory);
46 virtual const void*
Map(
bool )
const override {
return m_Memory; }
47 virtual void Unmap()
const override {}
62 void CopyOutTo(
void *)
const override { BOOST_ASSERT_MSG(
false,
"Unimplemented"); }
63 void CopyInFrom(
const void*)
override { BOOST_ASSERT_MSG(
false,
"Unimplemented"); }
73 const void* ConstCpuTensorHandle::GetConstTensor<void>()
const;
82 BOOST_ASSERT(CompatibleTypes<T>(
GetTensorInfo().GetDataType()));
83 return reinterpret_cast<T*
>(m_MutableMemory);
91 m_MutableMemory = mem;
99 void* m_MutableMemory;
103 void* CpuTensorHandle::GetTensor<void>()
const;
125 void CopyOutTo(
void* memory)
const override;
126 void CopyInFrom(
const void* memory)
override;
129 void CopyFrom(
const void* srcMemory,
unsigned int numBytes);
const TensorShape & GetShape() const
virtual ITensorHandle * GetParent() const override
Get the parent tensor if this is a subtensor.
virtual void Allocate()=0
Indicate to the memory manager that this resource is no longer active.
void SetMemory(void *mem)
virtual void Unmap() const override
Unmap the tensor data.
PassthroughCpuTensorHandle(const TensorInfo &tensorInfo, void *mem)
const T * GetConstTensor() const
Copyright (c) 2020 ARM Limited.
virtual void Manage() override
Indicate to the memory manager that this resource is active.
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...
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
ConstPassthroughCpuTensorHandle(const TensorInfo &tensorInfo, const void *mem)
virtual const void * Map(bool) const override
Map the tensor data for access.
TensorShape GetUnpaddedTensorStrides(const TensorInfo &tensorInfo)
ConstCpuTensorHandle(const TensorInfo &tensorInfo)
void SetConstMemory(const void *mem)
const TensorInfo & GetTensorInfo() const