diff options
author | Matthew Bentham <matthew.bentham@arm.com> | 2019-01-02 13:26:31 +0000 |
---|---|---|
committer | Matthew Bentham <matthew.bentham@arm.com> | 2019-01-10 16:12:45 +0000 |
commit | 1f0ff35236c1dd05954735f7fed9c2807770479e (patch) | |
tree | cc0614c31f897159b67801d1fa77f9ff20df4380 | |
parent | 60f906404e09aa2a8af0dbc8f1ae4c2fd2d4175a (diff) | |
download | armnn-1f0ff35236c1dd05954735f7fed9c2807770479e.tar.gz |
MLCE-82 Add IsLayerSupported tests for MEAN
Change-Id: I43be451f490db0154021f47a2fd49d1269cf5b95
-rw-r--r-- | src/backends/backendsCommon/test/IsLayerSupportedTestImpl.hpp | 26 | ||||
-rw-r--r-- | src/backends/cl/test/ClLayerSupportTests.cpp | 11 | ||||
-rw-r--r-- | src/backends/neon/test/NeonLayerSupportTests.cpp | 10 |
3 files changed, 47 insertions, 0 deletions
diff --git a/src/backends/backendsCommon/test/IsLayerSupportedTestImpl.hpp b/src/backends/backendsCommon/test/IsLayerSupportedTestImpl.hpp index d6528bb0ae..78716efaaf 100644 --- a/src/backends/backendsCommon/test/IsLayerSupportedTestImpl.hpp +++ b/src/backends/backendsCommon/test/IsLayerSupportedTestImpl.hpp @@ -592,4 +592,30 @@ bool IsConvertLayerSupportedTests(std::string& reasonIfUnsupported) return result; } +template<typename FactoryType, armnn::DataType InputDataType , armnn::DataType OutputDataType> +bool IsMeanLayerSupportedTests(std::string& reasonIfUnsupported) +{ + armnn::Graph graph; + static const std::vector<unsigned> axes = {1, 0}; + armnn::MeanDescriptor desc(axes, false); + + armnn::Layer* const layer = graph.AddLayer<armnn::MeanLayer>(desc, "LayerName"); + + armnn::Layer* const input = graph.AddLayer<armnn::InputLayer>(0, "input"); + armnn::Layer* const output = graph.AddLayer<armnn::OutputLayer>(0, "output"); + + armnn::TensorInfo inputTensorInfo({4, 3, 2}, InputDataType); + armnn::TensorInfo outputTensorInfo({2}, OutputDataType); + + input->GetOutputSlot(0).Connect(layer->GetInputSlot(0)); + input->GetOutputHandler(0).SetTensorInfo(inputTensorInfo); + layer->GetOutputSlot(0).Connect(output->GetInputSlot(0)); + layer->GetOutputHandler(0).SetTensorInfo(outputTensorInfo); + + bool result = FactoryType::IsLayerSupported(*layer, InputDataType, reasonIfUnsupported); + + return result; +} + + } //namespace diff --git a/src/backends/cl/test/ClLayerSupportTests.cpp b/src/backends/cl/test/ClLayerSupportTests.cpp index acfd8c3483..bcf057b1fb 100644 --- a/src/backends/cl/test/ClLayerSupportTests.cpp +++ b/src/backends/cl/test/ClLayerSupportTests.cpp @@ -7,6 +7,7 @@ #include <layers/ConvertFp16ToFp32Layer.hpp> #include <layers/ConvertFp32ToFp16Layer.hpp> +#include <layers/MeanLayer.hpp> #include <test/TensorHelpers.hpp> #include <backendsCommon/CpuTensorHandle.hpp> @@ -106,4 +107,14 @@ BOOST_FIXTURE_TEST_CASE(IsConvertFp32ToFp16SupportedFp32OutputCl, ClContextContr BOOST_CHECK_EQUAL(reasonIfUnsupported, "Output should be Float16"); } +BOOST_FIXTURE_TEST_CASE(IsMeanSupportedCl, ClContextControlFixture) +{ + std::string reasonIfUnsupported; + + bool result = IsMeanLayerSupportedTests<armnn::ClWorkloadFactory, + armnn::DataType::Float32, armnn::DataType::Float32>(reasonIfUnsupported); + + BOOST_CHECK(result); +} + BOOST_AUTO_TEST_SUITE_END() diff --git a/src/backends/neon/test/NeonLayerSupportTests.cpp b/src/backends/neon/test/NeonLayerSupportTests.cpp index c6d2731fd2..435afd23a6 100644 --- a/src/backends/neon/test/NeonLayerSupportTests.cpp +++ b/src/backends/neon/test/NeonLayerSupportTests.cpp @@ -61,4 +61,14 @@ BOOST_AUTO_TEST_CASE(IsConvertFp32ToFp16SupportedNeon) BOOST_CHECK(result); } +BOOST_AUTO_TEST_CASE(IsMeanSupportedNeon) +{ + std::string reasonIfUnsupported; + + bool result = IsMeanLayerSupportedTests<armnn::NeonWorkloadFactory, + armnn::DataType::Float32, armnn::DataType::Float32>(reasonIfUnsupported); + + BOOST_CHECK(result); +} + BOOST_AUTO_TEST_SUITE_END() |