aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan Eilers <jan.eilers@arm.com>2021-05-14 11:10:39 +0100
committerJan Eilers <jan.eilers@arm.com>2021-06-29 11:03:30 +0100
commitb082ed076b489f17bad3663005801b251d642108 (patch)
treebe4bc760626251a7411e0de7cd32e1a8a7631d5b /src
parent89fd793e179bf250c6c390c08dc42760343aa21b (diff)
downloadarmnn-b082ed076b489f17bad3663005801b251d642108.tar.gz
IVGCVSW-6027 Add IsConstant flag to TensorInfo
Signed-off-by: Jan Eilers <jan.eilers@arm.com> Change-Id: I7cb0a6a8856d8cd9949bec83c1ddce0a454fdf63
Diffstat (limited to 'src')
-rw-r--r--src/armnn/Tensor.cpp33
1 files changed, 27 insertions, 6 deletions
diff --git a/src/armnn/Tensor.cpp b/src/armnn/Tensor.cpp
index 449fdf1f04..6a4dbf8dae 100644
--- a/src/armnn/Tensor.cpp
+++ b/src/armnn/Tensor.cpp
@@ -339,16 +339,18 @@ void TensorShape::CheckSpecifiedNumDimensions() const
// ---
TensorInfo::TensorInfo()
-: m_DataType(DataType::Float32)
+: m_DataType(DataType::Float32), m_IsConstant(false)
{
}
TensorInfo::TensorInfo(const TensorShape& shape,
DataType dataType,
float quantizationScale,
- int32_t quantizationOffset)
+ int32_t quantizationOffset,
+ bool isConstant)
: m_Shape(shape)
, m_DataType(dataType)
+ , m_IsConstant(isConstant)
{
SetQuantizationScale(quantizationScale);
SetQuantizationOffset(quantizationOffset);
@@ -358,9 +360,11 @@ TensorInfo::TensorInfo(unsigned int numDimensions,
const unsigned int* dimensionSizes,
DataType dataType,
float quantizationScale,
- int32_t quantizationOffset)
+ int32_t quantizationOffset,
+ bool isConstant)
: m_Shape(numDimensions, dimensionSizes)
, m_DataType(dataType)
+ , m_IsConstant(isConstant)
{
SetQuantizationScale(quantizationScale);
SetQuantizationOffset(quantizationOffset);
@@ -369,9 +373,11 @@ TensorInfo::TensorInfo(unsigned int numDimensions,
TensorInfo::TensorInfo(const TensorShape& shape,
DataType dataType,
const std::vector<float>& quantizationScales,
- unsigned int quantizationDim)
+ unsigned int quantizationDim,
+ bool isConstant)
: m_Shape(shape)
, m_DataType(dataType)
+ , m_IsConstant(isConstant)
{
SetQuantizationScales(quantizationScales);
SetQuantizationDim(MakeOptional<unsigned int>(quantizationDim));
@@ -381,9 +387,11 @@ TensorInfo::TensorInfo(unsigned int numDimensions,
const unsigned int* dimensionSizes,
DataType dataType,
const std::vector<float>& quantizationScales,
- unsigned int quantizationDim)
+ unsigned int quantizationDim,
+ bool isConstant)
: m_Shape(numDimensions, dimensionSizes)
, m_DataType(dataType)
+ , m_IsConstant(isConstant)
{
SetQuantizationScales(quantizationScales);
SetQuantizationDim(MakeOptional<unsigned int>(quantizationDim));
@@ -392,6 +400,7 @@ TensorInfo::TensorInfo(unsigned int numDimensions,
TensorInfo::TensorInfo(const TensorInfo& other)
: m_Shape(other.m_Shape)
, m_DataType(other.m_DataType)
+, m_IsConstant(other.m_IsConstant)
, m_Quantization(other.m_Quantization)
{}
@@ -400,6 +409,7 @@ TensorInfo& TensorInfo::operator=(const TensorInfo& other)
m_Shape = other.m_Shape;
m_DataType = other.m_DataType;
m_Quantization = other.m_Quantization;
+ m_IsConstant = other.m_IsConstant;
return *this;
}
@@ -407,7 +417,8 @@ bool TensorInfo::operator==(const TensorInfo& other) const
{
return ((m_Shape == other.m_Shape) &&
(m_DataType == other.m_DataType) &&
- (m_Quantization == other.m_Quantization));
+ (m_Quantization == other.m_Quantization) &&
+ (m_IsConstant == other.m_IsConstant));
}
bool TensorInfo::operator!=(const TensorInfo& other) const
@@ -497,6 +508,16 @@ bool TensorInfo::IsQuantized() const
return IsQuantizedType(m_DataType);
}
+bool TensorInfo::IsConstant() const
+{
+ return m_IsConstant;
+}
+
+void TensorInfo::SetConstant(const bool IsConstant)
+{
+ m_IsConstant = IsConstant;
+}
+
// ---
// --- BaseTensor
// ---