diff options
author | arovir01 <Aron.Virginas-Tar@arm.com> | 2018-10-09 18:04:24 +0100 |
---|---|---|
committer | Matthew Bentham <matthew.bentham@arm.com> | 2018-10-22 16:57:53 +0100 |
commit | 43095f31edf103d71a8e2420b549d21fd349b49e (patch) | |
tree | 1414f25d8fadd4aa84fbed008743c4672b606b26 /src/backends/cl/test/ClLayerSupportTests.cpp | |
parent | 3b72db05d6f8df28728b292c8bbd27c402dc8704 (diff) | |
download | armnn-43095f31edf103d71a8e2420b549d21fd349b49e.tar.gz |
IVGCVSW-1988: Refactor backend-specific unit tests
Change-Id: I8eca81d2e0780390eaa837c186ffe1c7d41fdebe
Diffstat (limited to 'src/backends/cl/test/ClLayerSupportTests.cpp')
-rw-r--r-- | src/backends/cl/test/ClLayerSupportTests.cpp | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/src/backends/cl/test/ClLayerSupportTests.cpp b/src/backends/cl/test/ClLayerSupportTests.cpp new file mode 100644 index 0000000000..513366e8dc --- /dev/null +++ b/src/backends/cl/test/ClLayerSupportTests.cpp @@ -0,0 +1,104 @@ +// +// Copyright © 2017 Arm Ltd. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#include <armnn/layers/ConvertFp16ToFp32Layer.hpp> +#include <armnn/layers/ConvertFp32ToFp16Layer.hpp> +#include <armnn/test/TensorHelpers.hpp> + +#include <backends/CpuTensorHandle.hpp> +#include <backends/cl/ClWorkloadFactory.hpp> +#include <backends/cl/test/ClContextControlFixture.hpp> +#include <backends/test/IsLayerSupportedTestImpl.hpp> +#include <backends/test/LayerTests.hpp> + +#include <boost/test/unit_test.hpp> + +#include <string> + +BOOST_AUTO_TEST_SUITE(ClLayerSupport) + +BOOST_FIXTURE_TEST_CASE(IsLayerSupportedFloat16Cl, ClContextControlFixture) +{ + armnn::ClWorkloadFactory factory; + IsLayerSupportedTests<armnn::ClWorkloadFactory, armnn::DataType::Float16>(&factory); +} + +BOOST_FIXTURE_TEST_CASE(IsLayerSupportedFloat32Cl, ClContextControlFixture) +{ + armnn::ClWorkloadFactory factory; + IsLayerSupportedTests<armnn::ClWorkloadFactory, armnn::DataType::Float32>(&factory); +} + +BOOST_FIXTURE_TEST_CASE(IsLayerSupportedUint8Cl, ClContextControlFixture) +{ + armnn::ClWorkloadFactory factory; + IsLayerSupportedTests<armnn::ClWorkloadFactory, armnn::DataType::QuantisedAsymm8>(&factory); +} + +BOOST_FIXTURE_TEST_CASE(IsConvertFp16ToFp32SupportedCl, ClContextControlFixture) +{ + std::string reasonIfUnsupported; + + bool result = IsConvertLayerSupportedTests<armnn::ClWorkloadFactory, armnn::ConvertFp16ToFp32Layer, + armnn::DataType::Float16, armnn::DataType::Float32>(reasonIfUnsupported); + + BOOST_CHECK(result); +} + +BOOST_FIXTURE_TEST_CASE(IsConvertFp16ToFp32SupportedFp32InputCl, ClContextControlFixture) +{ + std::string reasonIfUnsupported; + + bool result = IsConvertLayerSupportedTests<armnn::ClWorkloadFactory, armnn::ConvertFp16ToFp32Layer, + armnn::DataType::Float32, armnn::DataType::Float32>(reasonIfUnsupported); + + BOOST_CHECK(!result); + BOOST_CHECK_EQUAL(reasonIfUnsupported, "Input should be Float16"); +} + +BOOST_FIXTURE_TEST_CASE(IsConvertFp16ToFp32SupportedFp16OutputCl, ClContextControlFixture) +{ + std::string reasonIfUnsupported; + + bool result = IsConvertLayerSupportedTests<armnn::ClWorkloadFactory, armnn::ConvertFp16ToFp32Layer, + armnn::DataType::Float16, armnn::DataType::Float16>(reasonIfUnsupported); + + BOOST_CHECK(!result); + BOOST_CHECK_EQUAL(reasonIfUnsupported, "Output should be Float32"); +} + +BOOST_FIXTURE_TEST_CASE(IsConvertFp32ToFp16SupportedCl, ClContextControlFixture) +{ + std::string reasonIfUnsupported; + + bool result = IsConvertLayerSupportedTests<armnn::ClWorkloadFactory, armnn::ConvertFp32ToFp16Layer, + armnn::DataType::Float32, armnn::DataType::Float16>(reasonIfUnsupported); + + BOOST_CHECK(result); +} + +BOOST_FIXTURE_TEST_CASE(IsConvertFp32ToFp16SupportedFp16InputCl, ClContextControlFixture) +{ + std::string reasonIfUnsupported; + + bool result = IsConvertLayerSupportedTests<armnn::ClWorkloadFactory, armnn::ConvertFp32ToFp16Layer, + armnn::DataType::Float16, armnn::DataType::Float16>(reasonIfUnsupported); + + BOOST_CHECK(!result); + BOOST_CHECK_EQUAL(reasonIfUnsupported, "Input should be Float32"); +} + +BOOST_FIXTURE_TEST_CASE(IsConvertFp32ToFp16SupportedFp32OutputCl, ClContextControlFixture) +{ + std::string reasonIfUnsupported; + + bool result = IsConvertLayerSupportedTests<armnn::ClWorkloadFactory, armnn::ConvertFp32ToFp16Layer, + armnn::DataType::Float32, armnn::DataType::Float32>(reasonIfUnsupported); + + BOOST_CHECK(!result); + BOOST_CHECK_EQUAL(reasonIfUnsupported, "Output should be Float16"); +} + +BOOST_AUTO_TEST_SUITE_END() |