From b1812636bd16c522cf6ac8d4caed94c9cf35c1c5 Mon Sep 17 00:00:00 2001 From: Pablo Marquez Tello Date: Tue, 11 Jan 2022 10:00:13 +0000 Subject: Enabled support for QASYMM8 in ClCastKernel * Partially resolves MLCE-736 Change-Id: I07140a21d9cc1f804cdf647ce863bb5e2eb10229 Signed-off-by: Pablo Marquez Tello Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/6918 Tested-by: Arm Jenkins Reviewed-by: Giorgio Arena Comments-Addressed: Arm Jenkins --- src/gpu/cl/kernels/ClCastKernel.cpp | 4 ++-- tests/validation/CL/Cast.cpp | 8 +++++++- tests/validation/CL/DepthConvertLayer.cpp | 4 ++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/gpu/cl/kernels/ClCastKernel.cpp b/src/gpu/cl/kernels/ClCastKernel.cpp index 48caf21d16..bfcd152297 100644 --- a/src/gpu/cl/kernels/ClCastKernel.cpp +++ b/src/gpu/cl/kernels/ClCastKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2021 Arm Limited. + * Copyright (c) 2016-2022 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -52,7 +52,7 @@ Status validate_arguments(const ITensorInfo *src, const ITensorInfo *dst, Conver ARM_COMPUTE_RETURN_ERROR_ON(src == dst); ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(src, 1, - DataType::U8, DataType::S8, DataType::QSYMM8_PER_CHANNEL, DataType::S16, + DataType::U8, DataType::S8, DataType::QASYMM8, DataType::QSYMM8_PER_CHANNEL, DataType::S16, DataType::U16, DataType::U32, DataType::S32, DataType::F16, DataType::F32); ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(dst, diff --git a/tests/validation/CL/Cast.cpp b/tests/validation/CL/Cast.cpp index 2ca8b58040..84455ba941 100644 --- a/tests/validation/CL/Cast.cpp +++ b/tests/validation/CL/Cast.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020 Arm Limited. + * Copyright (c) 2018-2020, 2022 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -48,6 +48,9 @@ constexpr AbsoluteTolerance one_tolerance(1); constexpr AbsoluteTolerance zero_tolerance(0); /** Input data sets **/ +// QASYMM8 +const auto CastQASYMM8toF32Dataset = combine(framework::dataset::make("DataType", DataType::QASYMM8), framework::dataset::make("DataType", DataType::F32)); + // U8 const auto CastU8toS8Dataset = combine(framework::dataset::make("DataType", DataType::U8), framework::dataset::make("DataType", DataType::S8)); const auto CastU8toU16Dataset = combine(framework::dataset::make("DataType", DataType::U8), framework::dataset::make("DataType", DataType::U16)); @@ -149,6 +152,9 @@ using CLCastToF32Fixture = CastValidationFixture, CastQASYMM8toF32Dataset, zero_tolerance) + // U8 CAST_SUITE(U8_to_S8, DataType::U8, DataType::S8, CLCastToS8Fixture, CastU8toS8Dataset, zero_tolerance) CAST_SUITE(U8_to_U16, DataType::U8, DataType::U16, CLCastToU16Fixture, CastU8toU16Dataset, zero_tolerance) diff --git a/tests/validation/CL/DepthConvertLayer.cpp b/tests/validation/CL/DepthConvertLayer.cpp index 8f14337b27..490b38ccf6 100644 --- a/tests/validation/CL/DepthConvertLayer.cpp +++ b/tests/validation/CL/DepthConvertLayer.cpp @@ -62,7 +62,7 @@ TEST_SUITE(DepthConvertLayer) // *INDENT-OFF* // clang-format off DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip( - framework::dataset::make("InputInfo", { TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QASYMM8), // Invalid data type combination + framework::dataset::make("InputInfo", { TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QASYMM8), // Support upcasting from QASYMM8 to S16 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), // Invalid data type combination TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), // Mismatching shapes TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8), // Invalid shift @@ -84,7 +84,7 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip( ConvertPolicy::WRAP, })), framework::dataset::make("Shift",{ 0, 0, 0, 1, 1, 0, })), - framework::dataset::make("Expected", { false, false, false, false, false, true})), + framework::dataset::make("Expected", { true, false, false, false, false, true})), input_info, output_info, policy, shift, expected) { ARM_COMPUTE_EXPECT(bool(CLDepthConvertLayer::validate(&input_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), policy, shift)) == expected, framework::LogLevel::ERRORS); -- cgit v1.2.1