aboutsummaryrefslogtreecommitdiff
path: root/src/backends/reference/workloads/BatchToSpaceNd.cpp
diff options
context:
space:
mode:
authorÉanna Ó Catháin <eanna.ocathain@arm.com>2018-11-12 17:14:43 +0000
committerSaoirse Stewart Arm <saoirse.stewart@arm.com>2018-11-12 21:59:48 +0000
commit95807cef855738ca481ace30f32ed9f245a098dd (patch)
tree7df7181d6dc19f3db3054614076478af4f417e8a /src/backends/reference/workloads/BatchToSpaceNd.cpp
parent111b5d94d7e854c21377f8d2c0b4234317a903f6 (diff)
downloadarmnn-95807cef855738ca481ace30f32ed9f245a098dd.tar.gz
Tidying up multiple issues
* Fixed error in InferOutputShape implementation * Added better error checking to the BatchToSpace implementation. * Added defaults to the batchToSpace descriptors. * Changed crops to be a vector of pairs to align with the SpaceToBatch implementation Change-Id: Ib1c16d871f0898a1caeb6629c1fee6380a773e14
Diffstat (limited to 'src/backends/reference/workloads/BatchToSpaceNd.cpp')
-rw-r--r--src/backends/reference/workloads/BatchToSpaceNd.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/backends/reference/workloads/BatchToSpaceNd.cpp b/src/backends/reference/workloads/BatchToSpaceNd.cpp
index bedf8418ef..4313085ba5 100644
--- a/src/backends/reference/workloads/BatchToSpaceNd.cpp
+++ b/src/backends/reference/workloads/BatchToSpaceNd.cpp
@@ -34,23 +34,17 @@ void BatchToSpaceNd(const DataLayoutIndexed& dataLayout,
const TensorInfo& inputTensorInfo,
const TensorInfo& outputTensorInfo,
const std::vector<unsigned int>& blockShape,
- const std::vector<std::vector<unsigned int>>& cropsData,
+ const std::vector<std::pair<unsigned int, unsigned int>>& cropsData,
const float* inputData,
float* outputData)
{
TensorShape inputShape = inputTensorInfo.GetShape();
- unsigned int inputNumDims = inputShape.GetNumDimensions();
- if (inputNumDims != 4)
- {
- throw armnn::InvalidArgumentException("Expected Input with 4 Dimensions");
- }
+
+ BOOST_ASSERT_MSG(inputShape.GetNumDimensions() == 4, "Expected Input with 4 Dimensions");
TensorShape outputShape = outputTensorInfo.GetShape();
- unsigned int outputNumDims = outputShape.GetNumDimensions();
- if (outputNumDims != 4)
- {
- throw armnn::InvalidArgumentException("Expected Output with 4 Dimensions");
- }
+
+ BOOST_ASSERT_MSG(outputShape.GetNumDimensions() == 4, "Expected Output with 4 Dimensions");
const unsigned int inputBatchSize = inputShape[0];
const unsigned int channels = inputShape[dataLayout.GetChannelsIndex()];
@@ -59,11 +53,15 @@ void BatchToSpaceNd(const DataLayoutIndexed& dataLayout,
const unsigned int outputHeight = outputShape[dataLayout.GetHeightIndex()];
const unsigned int outputWidth = outputShape[dataLayout.GetWidthIndex()];
+ BOOST_ASSERT_MSG(blockShape.size() > 0, "BlockShape must contain 1 or more entries");
+
const unsigned int blockShapeHeight = blockShape[0];
const unsigned int blockShapeWidth = blockShape[1];
- const unsigned int cropsTop = cropsData[0][0];
- const unsigned int cropsLeft = cropsData[1][0];
+ BOOST_ASSERT_MSG(cropsData.size() > 0, "Crops must contain 1 or more entries");
+
+ const unsigned int cropsTop = cropsData[0].first;
+ const unsigned int cropsLeft = cropsData[1].first;
for (unsigned int inBatch = 0; inBatch < inputBatchSize; ++inBatch)
{