aboutsummaryrefslogtreecommitdiff
path: root/src/armnn/test
diff options
context:
space:
mode:
authorÉanna Ó Catháin <eanna.ocathain@arm.com>2018-11-14 11:26:23 +0000
committerMatteo Martincigh <matteo.martincigh@arm.com>2018-11-14 12:00:22 +0000
commit262553e0d4e2571c8d7b3c57a7271c23a783e04b (patch)
tree05fa2b4b572a19e2de8eb3455f348416aca1eb0f /src/armnn/test
parent3aab7c301bcbc206169c12ac04162b1445b4d472 (diff)
downloadarmnn-262553e0d4e2571c8d7b3c57a7271c23a783e04b.tar.gz
IVGCVSW-2054: Fixing issue with InferOutputShape implementation in BatchToSpaceNdLayer.
* added Unit test Change-Id: I80f55e8c7afb39d96006c8dd027fc9683ea8182e
Diffstat (limited to 'src/armnn/test')
-rw-r--r--src/armnn/test/LayerValidateOutputTest.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/armnn/test/LayerValidateOutputTest.cpp b/src/armnn/test/LayerValidateOutputTest.cpp
new file mode 100644
index 0000000000..62b9c4a0d8
--- /dev/null
+++ b/src/armnn/test/LayerValidateOutputTest.cpp
@@ -0,0 +1,38 @@
+//
+// Copyright © 2017 Arm Ltd. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+#include <armnn/ArmNN.hpp>
+
+#include <boost/algorithm/string.hpp>
+#include <boost/test/unit_test.hpp>
+#include <layers/BatchToSpaceNdLayer.hpp>
+#include <Graph.hpp>
+
+
+BOOST_AUTO_TEST_SUITE(LayerValidateOutput)
+
+BOOST_AUTO_TEST_CASE(TestBatchToSpaceInferOutputShape)
+{
+ armnn::Graph graph;
+
+ armnn::BatchToSpaceNdDescriptor descriptor;
+ std::vector<unsigned int> theBlockShape = {2, 2};
+ descriptor.m_BlockShape = theBlockShape;
+ descriptor.m_DataLayout = armnn::DataLayout::NHWC;
+
+ armnn::BatchToSpaceNdLayer* const batchToSpaceLayer =
+ graph.AddLayer<armnn::BatchToSpaceNdLayer>(descriptor, "batchToSpace");
+
+ std::vector<armnn::TensorShape> shapes;
+ const std::vector<unsigned int> theDimSizes = {4, 2, 2, 1};
+ armnn::TensorShape shape(4, theDimSizes.data());
+ shapes.push_back(shape);
+
+ const std::vector<unsigned int> expectedDimSizes = {1, 4, 4, 1};
+ armnn::TensorShape expectedShape(4, expectedDimSizes.data());
+
+ BOOST_CHECK(expectedShape == batchToSpaceLayer->InferOutputShapes(shapes).at(0));
+}
+
+BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file