aboutsummaryrefslogtreecommitdiff
path: root/OutputShapeUtils.cpp
diff options
context:
space:
mode:
authorSadik Armagan <sadik.armagan@arm.com>2019-07-11 10:53:38 +0100
committerSadik Armagan <sadik.armagan@arm.com>2019-07-11 10:53:38 +0100
commit310d8ff46f26b6c656b417ac6dc59ef610aaa513 (patch)
tree5d7f85ce31e7cd0c4fcb5427addf32775de58733 /OutputShapeUtils.cpp
parent366e0a66f4566cf71dff3f850556350709ee66a8 (diff)
downloadandroid-nn-driver-310d8ff46f26b6c656b417ac6dc59ef610aaa513.tar.gz
IVGCVSW-3457 Fix VTS pad dynamic_output_shape test failures
Signed-off-by: Sadik Armagan <sadik.armagan@arm.com> Change-Id: Icb9a308f19ac6adbcf0d1de4d8733b95bab3bf0a
Diffstat (limited to 'OutputShapeUtils.cpp')
-rw-r--r--OutputShapeUtils.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/OutputShapeUtils.cpp b/OutputShapeUtils.cpp
index a0c624c8..a1a49d70 100644
--- a/OutputShapeUtils.cpp
+++ b/OutputShapeUtils.cpp
@@ -6,6 +6,7 @@
#include "OutputShapeUtils.hpp"
#include <algorithm>
+#include <vector>
namespace armnn_driver
{
@@ -17,6 +18,24 @@ bool IsDynamicOutput(const TensorInfo& outputInfo)
return outputInfo.GetNumElements() == 0u;
}
+TensorShape InferPadOutputShape(const TensorShape& inputShape,
+ const std::vector<std::pair<unsigned int, unsigned int>>& padList)
+{
+ const unsigned int numDims = inputShape.GetNumDimensions();
+
+ std::vector<unsigned int> outputDims;
+ TensorShape outputShape = TensorShape(numDims);
+ for (unsigned int dim = 0; dim < numDims; ++dim)
+ {
+ unsigned int dimSize = inputShape[dim];
+ const std::pair<unsigned int, unsigned int>& dimPadding = padList[dim];
+ dimSize += dimPadding.first;
+ dimSize += dimPadding.second;
+ outputShape[dim] = dimSize;
+ }
+ return outputShape;
+}
+
TensorShape InferPreluOutputShape(const TensorShape& inputShape, const TensorShape& alphaShape)
{
// NOTE: The inferred PReLU output size will be the maximum size along each dimension