A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
More...
#include <Tensor.hpp>
|
| ~BaseTensor () |
| Protected destructor to stop users from making these (could still new one on the heap and then leak it...) More...
|
|
const void * | m_MemoryArea |
|
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
- Examples
- AsyncExecutionSample.cpp, CustomMemoryAllocatorSample.cpp, DynamicSample.cpp, and SimpleSample.cpp.
Definition at line 329 of file Tensor.hpp.
◆ ConstTensor() [1/4]
◆ ConstTensor() [2/4]
ConstTensor implicitly constructed from non-const Tensor.
- Parameters
-
other | - reference to a constant Tensor. |
- Exceptions
-
Definition at line 344 of file Tensor.hpp.
344 : BaseTensor<const void*>(other.GetInfo(), other.GetMemoryArea())
346 if (!this->
GetInfo().IsConstant())
348 throw InvalidArgumentException(
"Invalid attempt to construct ConstTensor "
349 "from Tensor due to non-constant TensorInfo");
References BaseTensor< const void * >::GetInfo().
◆ ConstTensor() [3/4]
Constructor from a backing container.
- Parameters
-
container | - An stl-like container type which implements data() and size() methods. Presence of data() and size() is a strong indicator of the continuous memory layout of the container, which is a requirement for Tensor data. Tensor instances do not claim ownership of referenced memory regions, that is, no attempt will be made by ArmNN to free these memory regions automatically. |
- Exceptions
-
Definition at line 362 of file Tensor.hpp.
363 : BaseTensor<const void*>(info, container.data())
365 if (!this->
GetInfo().IsConstant())
367 throw InvalidArgumentException(
"Invalid attempt to construct ConstTensor from non-constant TensorInfo.");
369 if (container.size() *
sizeof(T) !=
info.GetNumBytes())
371 throw InvalidArgumentException(
"Container size is not correct");
References BaseTensor< const void * >::GetInfo(), and armnn::info.
◆ ConstTensor() [4/4]
ConstTensor constructed from TensorInfo and MemoryType template (a raw memory pointer).
- Parameters
-
info | - reference to a constant TensorInfo. |
memoryArea | - Region of CPU-addressable memory where tensor data will be stored. Must be valid while workloads are on the fly. Tensor instances do not claim ownership of referenced memory regions, that is, no attempt will be made by ArmNN to free these memory regions automatically. |
- Exceptions
-
Definition at line 384 of file Tensor.hpp.
385 : BaseTensor<const void*>(info, memoryArea)
387 if (!this->
GetInfo().IsConstant())
389 throw InvalidArgumentException(
"Invalid attempt to construct ConstTensor from non-constant TensorInfo.");
References BaseTensor< const void * >::GetInfo(), and armnn::info.
The documentation for this class was generated from the following file: