IVGCVSW-3457 Fix VTS pad dynamic_output_shape test failures
Signed-off-by: Sadik Armagan <sadik.armagan@arm.com>
Change-Id: Icb9a308f19ac6adbcf0d1de4d8733b95bab3bf0a
diff --git a/OutputShapeUtils.cpp b/OutputShapeUtils.cpp
index a0c624c..a1a49d7 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 @@
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