aboutsummaryrefslogtreecommitdiff
path: root/src/armnnUtils/TensorUtils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/armnnUtils/TensorUtils.cpp')
-rw-r--r--src/armnnUtils/TensorUtils.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/armnnUtils/TensorUtils.cpp b/src/armnnUtils/TensorUtils.cpp
index 5b5b2bd6e6..d77f5d74c3 100644
--- a/src/armnnUtils/TensorUtils.cpp
+++ b/src/armnnUtils/TensorUtils.cpp
@@ -131,6 +131,22 @@ TensorShape ExpandDims(const TensorShape& tensorShape, int axis)
return TensorShape(outputDim, outputShape.data());
}
+std::vector<unsigned int> SqueezeDims(const TensorShape& tensorShape)
+{
+ unsigned int outputDimSize = 0;
+ std::vector<unsigned int> squeezedDims;
+
+ for (unsigned int i = 0; i < tensorShape.GetNumDimensions(); ++i)
+ {
+ if (tensorShape[i] != 1)
+ {
+ squeezedDims.push_back(tensorShape[i]);
+ ++outputDimSize;
+ }
+ }
+ return squeezedDims;
+}
+
unsigned int GetNumElementsBetween(const TensorShape& shape,
const unsigned int firstAxisInclusive,
const unsigned int lastAxisExclusive)