From 1f0ff35236c1dd05954735f7fed9c2807770479e Mon Sep 17 00:00:00 2001 From: Matthew Bentham Date: Wed, 2 Jan 2019 13:26:31 +0000 Subject: MLCE-82 Add IsLayerSupported tests for MEAN Change-Id: I43be451f490db0154021f47a2fd49d1269cf5b95 --- .../test/IsLayerSupportedTestImpl.hpp | 26 ++++++++++++++++++++++ src/backends/cl/test/ClLayerSupportTests.cpp | 11 +++++++++ src/backends/neon/test/NeonLayerSupportTests.cpp | 10 +++++++++ 3 files changed, 47 insertions(+) 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 +bool IsMeanLayerSupportedTests(std::string& reasonIfUnsupported) +{ + armnn::Graph graph; + static const std::vector axes = {1, 0}; + armnn::MeanDescriptor desc(axes, false); + + armnn::Layer* const layer = graph.AddLayer(desc, "LayerName"); + + armnn::Layer* const input = graph.AddLayer(0, "input"); + armnn::Layer* const output = graph.AddLayer(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 #include +#include #include #include @@ -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(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(reasonIfUnsupported); + + BOOST_CHECK(result); +} + BOOST_AUTO_TEST_SUITE_END() -- cgit v1.2.1