John Richardson | dd715f2 | 2017-09-18 16:10:48 +0100 | [diff] [blame] | 1 | /* |
Giorgio Arena | ada6cbc | 2021-04-16 17:03:39 +0100 | [diff] [blame] | 2 | * Copyright (c) 2017-2021 Arm Limited. |
John Richardson | dd715f2 | 2017-09-18 16:10:48 +0100 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: MIT |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | * of this software and associated documentation files (the "Software"), to |
| 8 | * deal in the Software without restriction, including without limitation the |
| 9 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
| 10 | * sell copies of the Software, and to permit persons to whom the Software is |
| 11 | * furnished to do so, subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice and this permission notice shall be included in all |
| 14 | * copies or substantial portions of the Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 22 | * SOFTWARE. |
| 23 | */ |
| 24 | #include "arm_compute/runtime/CL/functions/CLPixelWiseMultiplication.h" |
| 25 | #include "tests/CL/CLAccessor.h" |
| 26 | #include "tests/PaddingCalculator.h" |
| 27 | #include "tests/datasets/ConvertPolicyDataset.h" |
| 28 | #include "tests/datasets/ShapeDatasets.h" |
| 29 | #include "tests/framework/Macros.h" |
| 30 | #include "tests/validation/Validation.h" |
John Richardson | dd715f2 | 2017-09-18 16:10:48 +0100 | [diff] [blame] | 31 | #include "tests/validation/fixtures/PixelWiseMultiplicationFixture.h" |
| 32 | |
| 33 | namespace arm_compute |
| 34 | { |
| 35 | namespace test |
| 36 | { |
| 37 | namespace validation |
| 38 | { |
Ramy Elgammal | ec320d9 | 2022-12-14 09:20:09 +0000 | [diff] [blame] | 39 | /** Synced with tests/validation/dynamic_fusion/gpu/cl/Mul.cpp from the dynamic fusion interface. |
| 40 | * Please check there for any differences in the coverage |
| 41 | */ |
John Richardson | dd715f2 | 2017-09-18 16:10:48 +0100 | [diff] [blame] | 42 | namespace |
| 43 | { |
Georgios Pinitas | bf28a3c | 2018-09-18 14:34:48 +0100 | [diff] [blame] | 44 | namespace |
| 45 | { |
| 46 | const float scale_255 = 1.f / 255.f; |
Michele Di Giorgio | d8a468f | 2019-06-19 15:34:41 +0100 | [diff] [blame] | 47 | constexpr AbsoluteTolerance<float> tolerance_qasymm8(1); /**< Tolerance value for comparing reference's output against implementation's output for 8-bit quantized asymmetric data types */ |
| 48 | constexpr AbsoluteTolerance<float> tolerance_qsymm16(1); /**< Tolerance value for comparing reference's output against implementation's output for 16-bit quantized symmetric data types */ |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 49 | const auto EmptyActivationFunctionsDataset = framework::dataset::make("ActivationInfo", |
| 50 | { ActivationLayerInfo() }); |
| 51 | const auto ActivationFunctionsDataset = framework::dataset::make("ActivationInfo", |
| 52 | { |
| 53 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::BOUNDED_RELU, 0.75f, 0.25f), |
| 54 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LOGISTIC, 0.75f, 0.25f) |
| 55 | }); |
Sang-Hoon Park | 95a6f72 | 2020-06-19 15:31:29 +0100 | [diff] [blame] | 56 | const auto InPlaceDataSet = framework::dataset::make("InPlace", { false }); |
Georgios Pinitas | bf28a3c | 2018-09-18 14:34:48 +0100 | [diff] [blame] | 57 | } //namespace |
John Richardson | dd715f2 | 2017-09-18 16:10:48 +0100 | [diff] [blame] | 58 | // *INDENT-OFF* |
| 59 | // clang-format off |
John Richardson | 9c450cc | 2017-11-22 12:00:41 +0000 | [diff] [blame] | 60 | #define VALIDATE(TYPE, TOLERANCE) validate(CLAccessor(_target), _reference, AbsoluteTolerance<TYPE>(TOLERANCE), 0.f); |
John Richardson | dd715f2 | 2017-09-18 16:10:48 +0100 | [diff] [blame] | 61 | |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 62 | #define PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE(TEST_NAME, FIXTURE, MODE, SHAPES, DT1, DT2, SCALE, RP, ACT, VALIDATE) \ |
John Richardson | dd715f2 | 2017-09-18 16:10:48 +0100 | [diff] [blame] | 63 | FIXTURE_DATA_TEST_CASE(TEST_NAME, CLPixelWiseMultiplication##FIXTURE, framework::DatasetMode::MODE, \ |
Sang-Hoon Park | 95a6f72 | 2020-06-19 15:31:29 +0100 | [diff] [blame] | 64 | combine(combine(combine(combine(combine(combine(combine( \ |
John Richardson | dd715f2 | 2017-09-18 16:10:48 +0100 | [diff] [blame] | 65 | datasets::SHAPES, \ |
| 66 | framework::dataset::make("DataType1", DataType::DT1)), \ |
| 67 | framework::dataset::make("DataType2", DataType::DT2)), \ |
| 68 | framework::dataset::make("Scale", std::move(SCALE))), \ |
| 69 | datasets::ConvertPolicies()), \ |
Sang-Hoon Park | 95a6f72 | 2020-06-19 15:31:29 +0100 | [diff] [blame] | 70 | framework::dataset::make("RoundingPolicy", RoundingPolicy::RP)), ACT), \ |
| 71 | InPlaceDataSet)) \ |
John Richardson | dd715f2 | 2017-09-18 16:10:48 +0100 | [diff] [blame] | 72 | { \ |
| 73 | VALIDATE \ |
| 74 | } |
John Richardson | dd715f2 | 2017-09-18 16:10:48 +0100 | [diff] [blame] | 75 | // clang-format on |
| 76 | // *INDENT-ON* |
| 77 | } // namespace |
| 78 | |
| 79 | template <typename T> |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 80 | using CLPixelWiseMultiplicationToF16Fixture = PixelWiseMultiplicationValidationFloatFixture<CLTensor, CLAccessor, CLPixelWiseMultiplication, T, half_float::half>; |
John Richardson | dd715f2 | 2017-09-18 16:10:48 +0100 | [diff] [blame] | 81 | template <typename T> |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 82 | using CLPixelWiseMultiplicationToF32Fixture = PixelWiseMultiplicationValidationFloatFixture<CLTensor, CLAccessor, CLPixelWiseMultiplication, T, float>; |
John Richardson | dd715f2 | 2017-09-18 16:10:48 +0100 | [diff] [blame] | 83 | template <typename T> |
Giorgio Arena | dd2d013 | 2021-04-22 14:34:15 +0100 | [diff] [blame] | 84 | using CLPixelWiseMultiplicationToF32BroadcastFixture = PixelWiseMultiplicationBroadcastValidationFloatFixture<CLTensor, CLAccessor, CLPixelWiseMultiplication, T, float>; |
Suhail Munshi | 448cb45 | 2021-04-23 16:23:25 +0100 | [diff] [blame] | 85 | template <typename T> |
| 86 | using CLPixelWiseMultiplicationIntegerFixture = PixelWiseMultiplicationValidationIntegerFixture<CLTensor, CLAccessor, CLPixelWiseMultiplication, T, int>; |
John Richardson | dd715f2 | 2017-09-18 16:10:48 +0100 | [diff] [blame] | 87 | |
| 88 | TEST_SUITE(CL) |
| 89 | TEST_SUITE(PixelWiseMultiplication) |
| 90 | |
Georgios Pinitas | f9d3a0a | 2017-11-03 19:01:44 +0000 | [diff] [blame] | 91 | // *INDENT-OFF* |
| 92 | // clang-format off |
| 93 | DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip( |
Giorgio Arena | 7062382 | 2017-11-27 15:50:10 +0000 | [diff] [blame] | 94 | framework::dataset::make("Input1Info", { TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), |
| 95 | TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), |
Giorgio Arena | 7062382 | 2017-11-27 15:50:10 +0000 | [diff] [blame] | 96 | TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), // Invalid scale |
| 97 | TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), // Invalid data type combination |
| 98 | TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), // Mismatching shapes |
Georgios Pinitas | f9d3a0a | 2017-11-03 19:01:44 +0000 | [diff] [blame] | 99 | }), |
Giorgio Arena | 7062382 | 2017-11-27 15:50:10 +0000 | [diff] [blame] | 100 | framework::dataset::make("Input2Info",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), |
| 101 | TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), |
Giorgio Arena | 7062382 | 2017-11-27 15:50:10 +0000 | [diff] [blame] | 102 | TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), |
| 103 | TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S16), |
| 104 | TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32), |
Georgios Pinitas | f9d3a0a | 2017-11-03 19:01:44 +0000 | [diff] [blame] | 105 | })), |
Giorgio Arena | 7062382 | 2017-11-27 15:50:10 +0000 | [diff] [blame] | 106 | framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S16), |
| 107 | TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), |
Giorgio Arena | 7062382 | 2017-11-27 15:50:10 +0000 | [diff] [blame] | 108 | TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), |
| 109 | TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), |
| 110 | TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32), |
Georgios Pinitas | f9d3a0a | 2017-11-03 19:01:44 +0000 | [diff] [blame] | 111 | })), |
Giorgio Arena | ada6cbc | 2021-04-16 17:03:39 +0100 | [diff] [blame] | 112 | framework::dataset::make("Scale",{ 2.f, 2.f, -1.f, 1.f, 1.f})), |
| 113 | framework::dataset::make("Expected", { true, true, false, false, false})), |
Georgios Pinitas | f9d3a0a | 2017-11-03 19:01:44 +0000 | [diff] [blame] | 114 | input1_info, input2_info, output_info, scale, expected) |
| 115 | { |
Giorgio Arena | 7062382 | 2017-11-27 15:50:10 +0000 | [diff] [blame] | 116 | bool has_error = bool(CLPixelWiseMultiplication::validate(&input1_info.clone()->set_is_resizable(false), &input2_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), scale, ConvertPolicy::WRAP, RoundingPolicy::TO_ZERO)); |
Georgios Pinitas | f9d3a0a | 2017-11-03 19:01:44 +0000 | [diff] [blame] | 117 | ARM_COMPUTE_EXPECT(has_error == expected, framework::LogLevel::ERRORS); |
| 118 | } |
| 119 | // clang-format on |
| 120 | // *INDENT-ON* |
Suhail Munshi | 448cb45 | 2021-04-23 16:23:25 +0100 | [diff] [blame] | 121 | TEST_SUITE(INT32) |
| 122 | FIXTURE_DATA_TEST_CASE(RunSmall, CLPixelWiseMultiplicationIntegerFixture<int>, framework::DatasetMode::PRECOMMIT, |
| 123 | combine(combine(combine(combine(combine(combine(combine( |
| 124 | datasets::SmallShapes(), |
| 125 | framework::dataset::make("DataType1", DataType::S32)), |
| 126 | framework::dataset::make("DataType2", DataType::S32)), |
Sheri Zhang | a387e27 | 2021-06-29 17:34:06 +0100 | [diff] [blame] | 127 | framework::dataset::make("Scale", { 1.f })), |
Suhail Munshi | 448cb45 | 2021-04-23 16:23:25 +0100 | [diff] [blame] | 128 | datasets::ConvertPolicies()), |
| 129 | framework::dataset::make("RoundingPolicy", RoundingPolicy::TO_NEAREST_UP)), |
| 130 | EmptyActivationFunctionsDataset), |
| 131 | InPlaceDataSet)) |
| 132 | { |
| 133 | validate(CLAccessor(_target), _reference); |
| 134 | } |
Sheri Zhang | a387e27 | 2021-06-29 17:34:06 +0100 | [diff] [blame] | 135 | FIXTURE_DATA_TEST_CASE(RunInplace, CLPixelWiseMultiplicationIntegerFixture<int>, framework::DatasetMode::PRECOMMIT, |
| 136 | combine(combine(combine(combine(combine(combine(combine(datasets::TinyShapes(), |
| 137 | framework::dataset::make("DataType1", DataType::S32)), |
| 138 | framework::dataset::make("DataType2", DataType::S32)), |
| 139 | framework::dataset::make("Scale", { 1.f })), |
| 140 | datasets::ConvertPolicies()), |
| 141 | framework::dataset::make("RoundingPolicy", RoundingPolicy::TO_NEAREST_UP)), |
| 142 | EmptyActivationFunctionsDataset), |
| 143 | framework::dataset::make("InPlace", { true }))) |
| 144 | { |
| 145 | validate(CLAccessor(_target), _reference); |
| 146 | } |
Suhail Munshi | 448cb45 | 2021-04-23 16:23:25 +0100 | [diff] [blame] | 147 | TEST_SUITE_END() |
Georgios Pinitas | f9d3a0a | 2017-11-03 19:01:44 +0000 | [diff] [blame] | 148 | |
John Richardson | dd715f2 | 2017-09-18 16:10:48 +0100 | [diff] [blame] | 149 | TEST_SUITE(F16toF16) |
John Richardson | dd715f2 | 2017-09-18 16:10:48 +0100 | [diff] [blame] | 150 | TEST_SUITE(Scale255) |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 151 | PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE(RunSmall, ToF16Fixture<half_float::half>, PRECOMMIT, SmallShapes(), F16, F16, scale_255, TO_NEAREST_UP, EmptyActivationFunctionsDataset, |
| 152 | VALIDATE(float, 1.f)) |
| 153 | PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE(RunWithActivation, ToF16Fixture<half_float::half>, ALL, TinyShapes(), F16, F16, scale_255, TO_NEAREST_UP, ActivationFunctionsDataset, VALIDATE(float, |
| 154 | 1.f)) |
John Richardson | dd715f2 | 2017-09-18 16:10:48 +0100 | [diff] [blame] | 155 | TEST_SUITE_END() // Scale255 |
John Richardson | dd715f2 | 2017-09-18 16:10:48 +0100 | [diff] [blame] | 156 | TEST_SUITE_END() // F16toF16 |
| 157 | |
| 158 | TEST_SUITE(F32toF32) |
John Richardson | dd715f2 | 2017-09-18 16:10:48 +0100 | [diff] [blame] | 159 | TEST_SUITE(Scale255) |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 160 | PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE(RunSmall, ToF32Fixture<float>, PRECOMMIT, SmallShapes(), F32, F32, scale_255, TO_NEAREST_UP, EmptyActivationFunctionsDataset, VALIDATE(float, 1.f)) |
| 161 | PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE(RunWithActivation, ToF32Fixture<float>, ALL, TinyShapes(), F32, F32, scale_255, TO_NEAREST_UP, ActivationFunctionsDataset, VALIDATE(float, 1.f)) |
Sheri Zhang | a387e27 | 2021-06-29 17:34:06 +0100 | [diff] [blame] | 162 | FIXTURE_DATA_TEST_CASE(RunInplace, CLPixelWiseMultiplicationToF32Fixture<float>, framework::DatasetMode::PRECOMMIT, |
| 163 | combine(combine(combine(combine(combine(combine(combine(datasets::TinyShapes(), |
| 164 | framework::dataset::make("DataTypeIn1", DataType::F32)), |
| 165 | framework::dataset::make("DataTypeIn2", DataType::F32)), |
| 166 | framework::dataset::make("Scale", { scale_255 })), |
| 167 | datasets::ConvertPolicies()), |
| 168 | framework::dataset::make("RoundingPolicy", RoundingPolicy::TO_NEAREST_UP)), |
| 169 | EmptyActivationFunctionsDataset), |
| 170 | framework::dataset::make("InPlace", { true }))) |
| 171 | { |
| 172 | // Validate output |
| 173 | VALIDATE(float, 1.f) |
| 174 | } |
John Richardson | dd715f2 | 2017-09-18 16:10:48 +0100 | [diff] [blame] | 175 | TEST_SUITE_END() // Scale255 |
John Richardson | dd715f2 | 2017-09-18 16:10:48 +0100 | [diff] [blame] | 176 | TEST_SUITE_END() // F32toF32 |
| 177 | |
Giorgio Arena | dd2d013 | 2021-04-22 14:34:15 +0100 | [diff] [blame] | 178 | PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE(RunSmallBroadcast, ToF32BroadcastFixture<float>, PRECOMMIT, SmallShapesBroadcast(), F32, F32, scale_255, TO_NEAREST_UP, |
| 179 | EmptyActivationFunctionsDataset, |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 180 | VALIDATE(float, 1.f)) |
Giorgio Arena | dd2d013 | 2021-04-22 14:34:15 +0100 | [diff] [blame] | 181 | PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE(RunWithActivationSmallBroadcast, ToF32BroadcastFixture<float>, ALL, TinyShapesBroadcast(), F32, F32, scale_255, TO_NEAREST_UP, |
| 182 | ActivationFunctionsDataset, |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 183 | VALIDATE(float, 1.f)) |
Georgios Pinitas | bf28a3c | 2018-09-18 14:34:48 +0100 | [diff] [blame] | 184 | |
| 185 | template <typename T> |
Michele Di Giorgio | 7a0212a | 2020-04-14 16:08:32 +0100 | [diff] [blame] | 186 | using CLPixelWiseMultiplicationQuantizedFixture = PixelWiseMultiplicationValidationQuantizedFixture<CLTensor, CLAccessor, CLPixelWiseMultiplication, T, T>; |
| 187 | using CLPixelWiseMultiplicationQSYMM16ToS32Fxture = PixelWiseMultiplicationValidationQuantizedFixture<CLTensor, CLAccessor, CLPixelWiseMultiplication, int16_t, int16_t, int32_t>; |
Georgios Pinitas | bf28a3c | 2018-09-18 14:34:48 +0100 | [diff] [blame] | 188 | |
Giorgio Arena | dd2d013 | 2021-04-22 14:34:15 +0100 | [diff] [blame] | 189 | template <typename T> |
| 190 | using CLPixelWiseMultiplicationQuantizedBroadcastFixture = PixelWiseMultiplicationBroadcastValidationQuantizedFixture<CLTensor, CLAccessor, CLPixelWiseMultiplication, T, T>; |
| 191 | |
Georgios Pinitas | bf28a3c | 2018-09-18 14:34:48 +0100 | [diff] [blame] | 192 | TEST_SUITE(Quantized) |
| 193 | TEST_SUITE(QASYMM8) |
Michele Di Giorgio | 9428a18 | 2020-03-30 14:10:20 +0100 | [diff] [blame] | 194 | FIXTURE_DATA_TEST_CASE(RunSmall, CLPixelWiseMultiplicationQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, |
Sang-Hoon Park | 95a6f72 | 2020-06-19 15:31:29 +0100 | [diff] [blame] | 195 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(datasets::SmallShapes(), |
| 196 | framework::dataset::make("DataTypeIn1", DataType::QASYMM8)), |
| 197 | framework::dataset::make("DataTypeIn2", DataType::QASYMM8)), |
| 198 | framework::dataset::make("DataTypeOut", DataType::QASYMM8)), |
| 199 | framework::dataset::make("Scale", { 1.f, 2.f })), |
| 200 | framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })), |
| 201 | framework::dataset::make("RoundingPolicy", RoundingPolicy::TO_NEAREST_EVEN)), |
| 202 | framework::dataset::make("Src0QInfo", { QuantizationInfo(5.f / 255.f, 20) })), |
| 203 | framework::dataset::make("Src1QInfo", { QuantizationInfo(2.f / 255.f, 10) })), |
| 204 | framework::dataset::make("OUtQInfo", { QuantizationInfo(1.f / 255.f, 5) })), |
| 205 | InPlaceDataSet)) |
Michele Di Giorgio | d8a468f | 2019-06-19 15:34:41 +0100 | [diff] [blame] | 206 | { |
| 207 | // Validate output |
| 208 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 209 | } |
Giorgio Arena | dd2d013 | 2021-04-22 14:34:15 +0100 | [diff] [blame] | 210 | |
| 211 | FIXTURE_DATA_TEST_CASE(RunSmallBroadcast, CLPixelWiseMultiplicationQuantizedBroadcastFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, |
| 212 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(datasets::SmallShapesBroadcast(), |
| 213 | framework::dataset::make("DataTypeIn1", DataType::QASYMM8)), |
| 214 | framework::dataset::make("DataTypeIn2", DataType::QASYMM8)), |
| 215 | framework::dataset::make("DataTypeOut", DataType::QASYMM8)), |
| 216 | framework::dataset::make("Scale", { 1.f, 2.f })), |
| 217 | framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })), |
| 218 | framework::dataset::make("RoundingPolicy", RoundingPolicy::TO_NEAREST_EVEN)), |
| 219 | framework::dataset::make("Src0QInfo", { QuantizationInfo(5.f / 255.f, 20) })), |
| 220 | framework::dataset::make("Src1QInfo", { QuantizationInfo(2.f / 255.f, 10) })), |
| 221 | framework::dataset::make("OUtQInfo", { QuantizationInfo(1.f / 255.f, 5) })), |
| 222 | InPlaceDataSet)) |
| 223 | { |
| 224 | // Validate output |
| 225 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 226 | } |
| 227 | |
Sheri Zhang | a387e27 | 2021-06-29 17:34:06 +0100 | [diff] [blame] | 228 | FIXTURE_DATA_TEST_CASE(RunInplace, CLPixelWiseMultiplicationQuantizedBroadcastFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, |
| 229 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(datasets::TinyShapesBroadcastInplace(), |
| 230 | framework::dataset::make("DataTypeIn1", DataType::QASYMM8)), |
| 231 | framework::dataset::make("DataTypeIn2", DataType::QASYMM8)), |
| 232 | framework::dataset::make("DataTypeOut", DataType::QASYMM8)), |
| 233 | framework::dataset::make("Scale", { 1.f, 2.f })), |
| 234 | framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })), |
| 235 | framework::dataset::make("RoundingPolicy", RoundingPolicy::TO_NEAREST_EVEN)), |
| 236 | framework::dataset::make("Src0QInfo", { QuantizationInfo(2.f / 255.f, 10) })), |
| 237 | framework::dataset::make("Src1QInfo", { QuantizationInfo(2.f / 255.f, 10) })), |
| 238 | framework::dataset::make("OUtQInfo", { QuantizationInfo(2.f / 255.f, 10) })), |
| 239 | framework::dataset::make("InPlace", { true }))) |
| 240 | { |
| 241 | // Validate output |
| 242 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 243 | } |
| 244 | |
Michele Di Giorgio | cbbed28 | 2019-12-20 13:26:08 +0000 | [diff] [blame] | 245 | TEST_SUITE_END() // QASYMM8 |
| 246 | |
| 247 | TEST_SUITE(QASYMM8_SIGNED) |
Michele Di Giorgio | 9428a18 | 2020-03-30 14:10:20 +0100 | [diff] [blame] | 248 | FIXTURE_DATA_TEST_CASE(RunSmall, CLPixelWiseMultiplicationQuantizedFixture<int8_t>, framework::DatasetMode::PRECOMMIT, |
Sang-Hoon Park | 95a6f72 | 2020-06-19 15:31:29 +0100 | [diff] [blame] | 249 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(datasets::SmallShapes(), |
| 250 | framework::dataset::make("DataTypeIn1", DataType::QASYMM8_SIGNED)), |
| 251 | framework::dataset::make("DataTypeIn2", DataType::QASYMM8_SIGNED)), |
| 252 | framework::dataset::make("DataTypeOut", DataType::QASYMM8_SIGNED)), |
| 253 | framework::dataset::make("Scale", { 1.f, 2.f })), |
| 254 | framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })), |
| 255 | framework::dataset::make("RoundingPolicy", RoundingPolicy::TO_NEAREST_EVEN)), |
| 256 | framework::dataset::make("Src0QInfo", { QuantizationInfo(5.f / 255.f, 20) })), |
| 257 | framework::dataset::make("Src1QInfo", { QuantizationInfo(2.f / 255.f, 10) })), |
| 258 | framework::dataset::make("OUtQInfo", { QuantizationInfo(1.f / 255.f, 5) })), |
| 259 | InPlaceDataSet)) |
Georgios Pinitas | bf28a3c | 2018-09-18 14:34:48 +0100 | [diff] [blame] | 260 | { |
| 261 | // Validate output |
| 262 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 263 | } |
Michele Di Giorgio | cbbed28 | 2019-12-20 13:26:08 +0000 | [diff] [blame] | 264 | TEST_SUITE_END() // QASYMM8_SIGNED |
| 265 | |
Michele Di Giorgio | d8a468f | 2019-06-19 15:34:41 +0100 | [diff] [blame] | 266 | TEST_SUITE(QSYMM16) |
Michele Di Giorgio | 9428a18 | 2020-03-30 14:10:20 +0100 | [diff] [blame] | 267 | FIXTURE_DATA_TEST_CASE(RunSmall, CLPixelWiseMultiplicationQuantizedFixture<int16_t>, framework::DatasetMode::PRECOMMIT, |
Sang-Hoon Park | 95a6f72 | 2020-06-19 15:31:29 +0100 | [diff] [blame] | 268 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(datasets::SmallShapes(), |
| 269 | framework::dataset::make("DataTypeIn1", DataType::QSYMM16)), |
| 270 | framework::dataset::make("DataTypeIn2", DataType::QSYMM16)), |
| 271 | framework::dataset::make("DataTypeOut", DataType::QSYMM16)), |
| 272 | framework::dataset::make("Scale", { 1.f, 2.f })), |
| 273 | framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })), |
| 274 | framework::dataset::make("RoundingPolicy", RoundingPolicy::TO_NEAREST_EVEN)), |
| 275 | framework::dataset::make("Src0QInfo", { QuantizationInfo(1.f / 32768.f, 0) })), |
| 276 | framework::dataset::make("Src1QInfo", { QuantizationInfo(2.f / 32768.f, 0) })), |
| 277 | framework::dataset::make("OutQInfo", { QuantizationInfo(5.f / 32768.f, 0) })), |
| 278 | InPlaceDataSet)) |
Michele Di Giorgio | d8a468f | 2019-06-19 15:34:41 +0100 | [diff] [blame] | 279 | { |
| 280 | // Validate output |
| 281 | validate(CLAccessor(_target), _reference, tolerance_qsymm16); |
| 282 | } |
Michele Di Giorgio | 9428a18 | 2020-03-30 14:10:20 +0100 | [diff] [blame] | 283 | FIXTURE_DATA_TEST_CASE(RunLarge, CLPixelWiseMultiplicationQuantizedFixture<int16_t>, framework::DatasetMode::NIGHTLY, |
Sang-Hoon Park | 95a6f72 | 2020-06-19 15:31:29 +0100 | [diff] [blame] | 284 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(datasets::LargeShapes(), |
| 285 | framework::dataset::make("DataTypeIn1", DataType::QSYMM16)), |
| 286 | framework::dataset::make("DataTypeIn2", DataType::QSYMM16)), |
| 287 | framework::dataset::make("DataTypeOut", DataType::QSYMM16)), |
| 288 | framework::dataset::make("Scale", { 1.f, 2.f })), |
| 289 | framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })), |
| 290 | framework::dataset::make("RoundingPolicy", RoundingPolicy::TO_NEAREST_EVEN)), |
| 291 | framework::dataset::make("Src0QInfo", { QuantizationInfo(1.f / 32768.f, 0) })), |
| 292 | framework::dataset::make("Src1QInfo", { QuantizationInfo(2.f / 32768.f, 0) })), |
| 293 | framework::dataset::make("OutQInfo", { QuantizationInfo(5.f / 32768.f, 0) })), |
| 294 | InPlaceDataSet)) |
Michele Di Giorgio | d8a468f | 2019-06-19 15:34:41 +0100 | [diff] [blame] | 295 | { |
| 296 | // Validate output |
| 297 | validate(CLAccessor(_target), _reference, tolerance_qsymm16); |
| 298 | } |
| 299 | TEST_SUITE_END() // QSYMM16 |
Michele Di Giorgio | 7a0212a | 2020-04-14 16:08:32 +0100 | [diff] [blame] | 300 | TEST_SUITE(QSYMM16ToS32) |
| 301 | FIXTURE_DATA_TEST_CASE(RunSmall, CLPixelWiseMultiplicationQSYMM16ToS32Fxture, framework::DatasetMode::ALL, |
Sang-Hoon Park | 95a6f72 | 2020-06-19 15:31:29 +0100 | [diff] [blame] | 302 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(datasets::SmallShapes(), |
| 303 | framework::dataset::make("DataTypeIn1", DataType::QSYMM16)), |
| 304 | framework::dataset::make("DataTypeIn2", DataType::QSYMM16)), |
| 305 | framework::dataset::make("DataTypeOut", DataType::S32)), |
| 306 | framework::dataset::make("Scale", { 1.f })), |
| 307 | framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })), |
| 308 | framework::dataset::make("RoundingPolicy", RoundingPolicy::TO_NEAREST_EVEN)), |
| 309 | framework::dataset::make("Src0QInfo", { QuantizationInfo(1.f / 32768.f, 0) })), |
| 310 | framework::dataset::make("Src1QInfo", { QuantizationInfo(2.f / 32768.f, 0) })), |
| 311 | framework::dataset::make("OutQInfo", { QuantizationInfo(1.f, 0) })), |
| 312 | InPlaceDataSet)) |
Michele Di Giorgio | 7a0212a | 2020-04-14 16:08:32 +0100 | [diff] [blame] | 313 | { |
| 314 | // Validate output |
| 315 | validate(CLAccessor(_target), _reference, tolerance_qsymm16); |
| 316 | } |
| 317 | TEST_SUITE_END() // QSYMM16ToS32 |
Georgios Pinitas | bf28a3c | 2018-09-18 14:34:48 +0100 | [diff] [blame] | 318 | TEST_SUITE_END() // Quantized |
| 319 | |
John Richardson | dd715f2 | 2017-09-18 16:10:48 +0100 | [diff] [blame] | 320 | TEST_SUITE_END() // PixelWiseMultiplication |
Georgios Pinitas | bf28a3c | 2018-09-18 14:34:48 +0100 | [diff] [blame] | 321 | TEST_SUITE_END() // CL |
John Richardson | dd715f2 | 2017-09-18 16:10:48 +0100 | [diff] [blame] | 322 | } // namespace validation |
| 323 | } // namespace test |
| 324 | } // namespace arm_compute |