From 0fe7376f6982842e32591f3996d5ee650d22156f Mon Sep 17 00:00:00 2001 From: Francis Murtagh Date: Thu, 20 Aug 2020 15:38:29 +0100 Subject: Bugfix: Allow permutation of QuantizationDim Signed-off-by: Francis Murtagh Change-Id: Ib98ec471e6fdd47600b7c62d0b4d19dd36e20cbd --- src/armnn/test/UtilsTests.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/armnn/test') diff --git a/src/armnn/test/UtilsTests.cpp b/src/armnn/test/UtilsTests.cpp index 0bae756a71..fb078de32f 100644 --- a/src/armnn/test/UtilsTests.cpp +++ b/src/armnn/test/UtilsTests.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -245,4 +246,24 @@ BOOST_AUTO_TEST_CASE(CyclicalGraphTopologicalSortTest) BOOST_TEST(!sortCompleted); } +BOOST_AUTO_TEST_CASE(PermuteQuantizationDim) +{ + std::vector scales; + + // Set QuantizationDim to be index 1 + const armnn::TensorInfo info({ 1, 2, 3, 4 }, armnn::DataType::Float32, scales, 1U); + BOOST_CHECK(info.GetQuantizationDim().value() == 1U); + + // Permute so that index 1 moves to final index i.e. index 3 + armnn::PermutationVector mappings({ 0, 3, 2, 1 }); + auto permutedPerChannel = armnnUtils::Permuted(info, mappings, true); + auto permuted = armnnUtils::Permuted(info, mappings); + + // Check that QuantizationDim is in index 3 + BOOST_CHECK(permutedPerChannel.GetQuantizationDim().value() == 3U); + + // Check previous implementation unchanged + BOOST_CHECK(permuted.GetQuantizationDim().value() == 1U); +} + BOOST_AUTO_TEST_SUITE_END() -- cgit v1.2.1