19 auto runningSize = size;
22 for (
unsigned int i=0; i < lastIdx ; i++)
24 strides[lastIdx-i] = runningSize;
25 runningSize *= shape[lastIdx-i];
27 strides[0] = runningSize;
32: m_TensorInfo(tensorInfo)
45, m_MutableMemory(nullptr)
52 return m_MutableMemory;
100 "that already has allocated memory.");
104void ScopedTensorHandle::CopyOutTo(
void* memory)
const
111 if (memory ==
nullptr)
113 throw NullPointerException(
"TensorHandle::CopyOutTo called with a null dest pointer");
118void ScopedTensorHandle::CopyInFrom(
const void* memory)
123 throw NullPointerException(
"TensorHandle::CopyInFrom called with a null dest pointer");
125 if (memory ==
nullptr)
127 throw NullPointerException(
"TensorHandle::CopyInFrom called with a null src pointer");
134 CopyFrom(other.GetTensor<
void>(), other.GetTensorInfo().GetNumBytes());
137void ScopedTensorHandle::CopyFrom(
const void* srcMemory,
unsigned int numBytes)
141 throw NullPointerException(
"TensorHandle::CopyFrom called on an already allocated TensorHandle");
145 std::stringstream msg;
147 ") does not match the number of bytes being copied (" << numBytes <<
")";
148 throw armnn::Exception(msg.str());
MemoryType GetMemoryArea() const
unsigned int GetNumBytes() const
virtual void Allocate() override
Indicate to the memory manager that this resource is no longer active.
ConstTensorHandle(const TensorInfo &tensorInfo)
const TensorInfo & GetTensorInfo() const
const T * GetConstTensor() const
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
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
unsigned int GetNumBytes() const
DataType GetDataType() const
unsigned int GetNumDimensions() const
Function that returns the tensor rank.
Copyright (c) 2021 ARM Limited and Contributors.
TensorShape GetUnpaddedTensorStrides(const TensorInfo &tensorInfo)
constexpr unsigned int GetDataTypeSize(DataType dataType)