14 #include <initializer_list> 28 TensorShape(
unsigned int numDimensions,
const unsigned int* dimensionSizes);
30 TensorShape(std::initializer_list<unsigned int> dimensionSizeList);
47 std::array<unsigned int, MaxNumOfTensorDimensions> m_Dimensions;
48 unsigned int m_NumDimensions;
50 void CheckDimensionIndex(
unsigned int i)
const;
61 float quantizationScale = 0.0f,
62 int32_t quantizationOffset = 0);
65 const unsigned int* dimensionSizes,
67 float quantizationScale = 0.0f,
68 int32_t quantizationOffset = 0);
72 const std::vector<float>& quantizationScales,
73 unsigned int quantizationDim);
76 const unsigned int* dimensionSizes,
78 const std::vector<float>& quantizationScales,
79 unsigned int quantizationDim);
100 bool HasPerAxisQuantization()
const;
102 std::vector<float> GetQuantizationScales()
const;
103 void SetQuantizationScales(
const std::vector<float>& scales);
105 float GetQuantizationScale()
const;
108 int32_t GetQuantizationOffset()
const;
114 bool IsQuantized()
const;
117 bool IsTypeSpaceMatch(
const TensorInfo& other)
const;
119 unsigned int GetNumBytes()
const;
133 bool operator==(
const Quantization& other)
const 135 return ((m_Scales == other.m_Scales) && (m_Offset == other.m_Offset) &&
136 (m_QuantizationDim == other.m_QuantizationDim));
139 std::vector<float> m_Scales;
148 template<
typename MemoryType>
214 template <
template<
typename,
typename...>
class ContainerType,
typename T,
typename...ContainerArgs >
216 :
BaseTensor<const void*>(info, container.data())
218 if (container.size() *
sizeof(T) != info.
GetNumBytes())
225 using InputTensors = std::vector<std::pair<LayerBindingId, class ConstTensor>>;
unsigned int GetNumElements() const
bool operator!=(const TensorShape &other) const
unsigned int operator[](unsigned int i) const
const TensorShape & GetShape() const
TensorShape & operator=(const TensorShape &other)
boxEncodingsInfo SetQuantizationOffset(1)
const TensorShape & GetShape() const
unsigned int GetNumBytes() const
unsigned int GetNumElements() const
std::vector< std::pair< LayerBindingId, class ConstTensor > > InputTensors
MemoryType GetMemoryArea() const
Copyright (c) 2020 ARM Limited.
bool HasMultipleQuantizationScales() const
void SetShape(const TensorShape &newShape)
A tensor defined by a TensorInfo (shape and data type) and a mutable backing store.
bool operator==(const TensorShape &other) const
boxEncodingsInfo SetQuantizationScale(1.0f)
TensorShape()
Empty (invalid) constructor.
DataType GetDataType() const
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
std::vector< std::pair< LayerBindingId, class Tensor > > OutputTensors
const TensorInfo & GetInfo() const
void SetDataType(DataType type)
ConstTensor(const TensorInfo &info, const ContainerType< T, ContainerArgs... > &container)
Constructor from a backing container.
EmptyOptional is used to initialize the Optional class in case we want to have default value for an O...
std::pair< armnn::LayerBindingId, armnn::TensorInfo > BindingPointInfo
ConstTensor(const Tensor &other)
Can be implicitly constructed from non-const Tensor.
unsigned int GetNumDimensions() const
unsigned int GetNumDimensions() const
~BaseTensor()
Protected destructor to stop users from making these (could still new one on the heap and then leak i...
DataType GetDataType() const
unsigned int GetNumDimensions() const
unsigned int GetNumElements() const
unsigned int GetNumBytes() const