aboutsummaryrefslogtreecommitdiff
path: root/src/armnn/test/optimizations/OptimizeInversePermutesTests.cpp
diff options
context:
space:
mode:
authorRob Hughes <robert.hughes@arm.com>2019-09-24 09:34:53 +0100
committerJim Flynn Arm <jim.flynn@arm.com>2019-09-25 02:44:48 +0000
commit95e73d77b9a79f7d350a39d85f07d09cd58422cc (patch)
tree8b713e8d29d433a28b29b8a9ce34052e8cccd08c /src/armnn/test/optimizations/OptimizeInversePermutesTests.cpp
parent4833cea9036df428634cf64d8f1c4b54fc5da41f (diff)
downloadarmnn-95e73d77b9a79f7d350a39d85f07d09cd58422cc.tar.gz
NNXSW-1826 Move tests for Optimization classes to separate files
This splits up the >1000 line OptimizerTests.cpp file. Each Optimization class now has its own test file, all of which are in a subfolder of tests called "optimizations". The original OptimizerTests.cpp now contains mostly (completely?) tests for validating output shapes, which perhaps should be moved to test files specific to the layer types they are testing. Change-Id: Icd1196cad8b720abcb156921aab1adbd4026756b Signed-off-by: Rob Hughes <robert.hughes@arm.com>
Diffstat (limited to 'src/armnn/test/optimizations/OptimizeInversePermutesTests.cpp')
-rw-r--r--src/armnn/test/optimizations/OptimizeInversePermutesTests.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/armnn/test/optimizations/OptimizeInversePermutesTests.cpp b/src/armnn/test/optimizations/OptimizeInversePermutesTests.cpp
new file mode 100644
index 0000000000..dcf955956d
--- /dev/null
+++ b/src/armnn/test/optimizations/OptimizeInversePermutesTests.cpp
@@ -0,0 +1,42 @@
+//
+// Copyright © 2017 Arm Ltd. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#include "../TestUtils.hpp"
+
+#include <Optimizer.hpp>
+
+#include <boost/test/unit_test.hpp>
+
+using namespace armnn;
+
+BOOST_AUTO_TEST_SUITE(Optimizer)
+using namespace armnn::optimizations;
+
+BOOST_AUTO_TEST_CASE(OptimizeInversePermutesTest)
+{
+ armnn::Graph graph;
+
+ auto output = graph.AddLayer<armnn::OutputLayer>(0, "output");
+
+ graph.InsertNewLayer<armnn::InputLayer>(output->GetInputSlot(0), 0, "input");
+
+ // Inserts two permutes, one the inverse of the other.
+ graph.InsertNewLayer<armnn::PermuteLayer>(output->GetInputSlot(0), armnn::PermuteDescriptor({ 0, 2, 3, 1 }),
+ "perm0231");
+ graph.InsertNewLayer<armnn::PermuteLayer>(output->GetInputSlot(0), armnn::PermuteDescriptor({ 0, 3, 1, 2 }),
+ "perm0312");
+
+ BOOST_TEST(CheckSequence(graph.cbegin(), graph.cend(), &IsLayerOfType<armnn::InputLayer>,
+ &IsLayerOfType<armnn::PermuteLayer>, &IsLayerOfType<armnn::PermuteLayer>,
+ &IsLayerOfType<armnn::OutputLayer>));
+
+ armnn::Optimizer::Pass(graph, armnn::MakeOptimizations(OptimizeInversePermutes()));
+
+ // The permutes are removed.
+ BOOST_TEST(CheckSequence(graph.cbegin(), graph.cend(), &IsLayerOfType<armnn::InputLayer>,
+ &IsLayerOfType<armnn::OutputLayer>));
+}
+
+BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file