blob: 84aa2e7ee675050edad675a2647f18c00c82b702 [file] [log] [blame]
John Richardsondd715f22017-09-18 16:10:48 +01001/*
Giorgio Arenaada6cbc2021-04-16 17:03:39 +01002 * Copyright (c) 2017-2021 Arm Limited.
John Richardsondd715f22017-09-18 16:10:48 +01003 *
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 Richardsondd715f22017-09-18 16:10:48 +010031#include "tests/validation/fixtures/PixelWiseMultiplicationFixture.h"
32
33namespace arm_compute
34{
35namespace test
36{
37namespace validation
38{
39namespace
40{
Georgios Pinitasbf28a3c2018-09-18 14:34:48 +010041namespace
42{
43const float scale_255 = 1.f / 255.f;
Michele Di Giorgiod8a468f2019-06-19 15:34:41 +010044constexpr AbsoluteTolerance<float> tolerance_qasymm8(1); /**< Tolerance value for comparing reference's output against implementation's output for 8-bit quantized asymmetric data types */
45constexpr AbsoluteTolerance<float> tolerance_qsymm16(1); /**< Tolerance value for comparing reference's output against implementation's output for 16-bit quantized symmetric data types */
Giorgio Arena8b2a7d32020-02-11 17:21:31 +000046const auto EmptyActivationFunctionsDataset = framework::dataset::make("ActivationInfo",
47{ ActivationLayerInfo() });
48const auto ActivationFunctionsDataset = framework::dataset::make("ActivationInfo",
49{
50 ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::BOUNDED_RELU, 0.75f, 0.25f),
51 ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LOGISTIC, 0.75f, 0.25f)
52});
Sang-Hoon Park95a6f722020-06-19 15:31:29 +010053const auto InPlaceDataSet = framework::dataset::make("InPlace", { false });
Georgios Pinitasbf28a3c2018-09-18 14:34:48 +010054} //namespace
John Richardsondd715f22017-09-18 16:10:48 +010055// *INDENT-OFF*
56// clang-format off
John Richardson9c450cc2017-11-22 12:00:41 +000057#define VALIDATE(TYPE, TOLERANCE) validate(CLAccessor(_target), _reference, AbsoluteTolerance<TYPE>(TOLERANCE), 0.f);
John Richardsondd715f22017-09-18 16:10:48 +010058
Giorgio Arena8b2a7d32020-02-11 17:21:31 +000059#define PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE(TEST_NAME, FIXTURE, MODE, SHAPES, DT1, DT2, SCALE, RP, ACT, VALIDATE) \
John Richardsondd715f22017-09-18 16:10:48 +010060 FIXTURE_DATA_TEST_CASE(TEST_NAME, CLPixelWiseMultiplication##FIXTURE, framework::DatasetMode::MODE, \
Sang-Hoon Park95a6f722020-06-19 15:31:29 +010061 combine(combine(combine(combine(combine(combine(combine( \
John Richardsondd715f22017-09-18 16:10:48 +010062 datasets::SHAPES, \
63 framework::dataset::make("DataType1", DataType::DT1)), \
64 framework::dataset::make("DataType2", DataType::DT2)), \
65 framework::dataset::make("Scale", std::move(SCALE))), \
66 datasets::ConvertPolicies()), \
Sang-Hoon Park95a6f722020-06-19 15:31:29 +010067 framework::dataset::make("RoundingPolicy", RoundingPolicy::RP)), ACT), \
68 InPlaceDataSet)) \
John Richardsondd715f22017-09-18 16:10:48 +010069 { \
70 VALIDATE \
71 }
John Richardsondd715f22017-09-18 16:10:48 +010072// clang-format on
73// *INDENT-ON*
74} // namespace
75
76template <typename T>
Giorgio Arena8b2a7d32020-02-11 17:21:31 +000077using CLPixelWiseMultiplicationToF16Fixture = PixelWiseMultiplicationValidationFloatFixture<CLTensor, CLAccessor, CLPixelWiseMultiplication, T, half_float::half>;
John Richardsondd715f22017-09-18 16:10:48 +010078template <typename T>
Giorgio Arena8b2a7d32020-02-11 17:21:31 +000079using CLPixelWiseMultiplicationToF32Fixture = PixelWiseMultiplicationValidationFloatFixture<CLTensor, CLAccessor, CLPixelWiseMultiplication, T, float>;
John Richardsondd715f22017-09-18 16:10:48 +010080template <typename T>
Giorgio Arenadd2d0132021-04-22 14:34:15 +010081using CLPixelWiseMultiplicationToF32BroadcastFixture = PixelWiseMultiplicationBroadcastValidationFloatFixture<CLTensor, CLAccessor, CLPixelWiseMultiplication, T, float>;
Suhail Munshi448cb452021-04-23 16:23:25 +010082template <typename T>
83using CLPixelWiseMultiplicationIntegerFixture = PixelWiseMultiplicationValidationIntegerFixture<CLTensor, CLAccessor, CLPixelWiseMultiplication, T, int>;
John Richardsondd715f22017-09-18 16:10:48 +010084
85TEST_SUITE(CL)
86TEST_SUITE(PixelWiseMultiplication)
87
Georgios Pinitasf9d3a0a2017-11-03 19:01:44 +000088// *INDENT-OFF*
89// clang-format off
90DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(
Giorgio Arena70623822017-11-27 15:50:10 +000091 framework::dataset::make("Input1Info", { TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
92 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
Giorgio Arena70623822017-11-27 15:50:10 +000093 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), // Invalid scale
94 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), // Invalid data type combination
95 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), // Mismatching shapes
Georgios Pinitasf9d3a0a2017-11-03 19:01:44 +000096 }),
Giorgio Arena70623822017-11-27 15:50:10 +000097 framework::dataset::make("Input2Info",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
98 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
Giorgio Arena70623822017-11-27 15:50:10 +000099 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
100 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S16),
101 TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32),
Georgios Pinitasf9d3a0a2017-11-03 19:01:44 +0000102 })),
Giorgio Arena70623822017-11-27 15:50:10 +0000103 framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S16),
104 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
Giorgio Arena70623822017-11-27 15:50:10 +0000105 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
106 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
107 TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32),
Georgios Pinitasf9d3a0a2017-11-03 19:01:44 +0000108 })),
Giorgio Arenaada6cbc2021-04-16 17:03:39 +0100109 framework::dataset::make("Scale",{ 2.f, 2.f, -1.f, 1.f, 1.f})),
110 framework::dataset::make("Expected", { true, true, false, false, false})),
Georgios Pinitasf9d3a0a2017-11-03 19:01:44 +0000111 input1_info, input2_info, output_info, scale, expected)
112{
Giorgio Arena70623822017-11-27 15:50:10 +0000113 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 Pinitasf9d3a0a2017-11-03 19:01:44 +0000114 ARM_COMPUTE_EXPECT(has_error == expected, framework::LogLevel::ERRORS);
115}
116// clang-format on
117// *INDENT-ON*
Suhail Munshi448cb452021-04-23 16:23:25 +0100118TEST_SUITE(INT32)
119FIXTURE_DATA_TEST_CASE(RunSmall, CLPixelWiseMultiplicationIntegerFixture<int>, framework::DatasetMode::PRECOMMIT,
120 combine(combine(combine(combine(combine(combine(combine(
121 datasets::SmallShapes(),
122 framework::dataset::make("DataType1", DataType::S32)),
123 framework::dataset::make("DataType2", DataType::S32)),
Sheri Zhanga387e272021-06-29 17:34:06 +0100124 framework::dataset::make("Scale", { 1.f })),
Suhail Munshi448cb452021-04-23 16:23:25 +0100125 datasets::ConvertPolicies()),
126 framework::dataset::make("RoundingPolicy", RoundingPolicy::TO_NEAREST_UP)),
127 EmptyActivationFunctionsDataset),
128 InPlaceDataSet))
129{
130 validate(CLAccessor(_target), _reference);
131}
Sheri Zhanga387e272021-06-29 17:34:06 +0100132FIXTURE_DATA_TEST_CASE(RunInplace, CLPixelWiseMultiplicationIntegerFixture<int>, framework::DatasetMode::PRECOMMIT,
133 combine(combine(combine(combine(combine(combine(combine(datasets::TinyShapes(),
134 framework::dataset::make("DataType1", DataType::S32)),
135 framework::dataset::make("DataType2", DataType::S32)),
136 framework::dataset::make("Scale", { 1.f })),
137 datasets::ConvertPolicies()),
138 framework::dataset::make("RoundingPolicy", RoundingPolicy::TO_NEAREST_UP)),
139 EmptyActivationFunctionsDataset),
140 framework::dataset::make("InPlace", { true })))
141{
142 validate(CLAccessor(_target), _reference);
143}
Suhail Munshi448cb452021-04-23 16:23:25 +0100144TEST_SUITE_END()
Georgios Pinitasf9d3a0a2017-11-03 19:01:44 +0000145
John Richardsondd715f22017-09-18 16:10:48 +0100146TEST_SUITE(F16toF16)
John Richardsondd715f22017-09-18 16:10:48 +0100147TEST_SUITE(Scale255)
Giorgio Arena8b2a7d32020-02-11 17:21:31 +0000148PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE(RunSmall, ToF16Fixture<half_float::half>, PRECOMMIT, SmallShapes(), F16, F16, scale_255, TO_NEAREST_UP, EmptyActivationFunctionsDataset,
149 VALIDATE(float, 1.f))
150PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE(RunWithActivation, ToF16Fixture<half_float::half>, ALL, TinyShapes(), F16, F16, scale_255, TO_NEAREST_UP, ActivationFunctionsDataset, VALIDATE(float,
151 1.f))
John Richardsondd715f22017-09-18 16:10:48 +0100152TEST_SUITE_END() // Scale255
John Richardsondd715f22017-09-18 16:10:48 +0100153TEST_SUITE_END() // F16toF16
154
155TEST_SUITE(F32toF32)
John Richardsondd715f22017-09-18 16:10:48 +0100156TEST_SUITE(Scale255)
Giorgio Arena8b2a7d32020-02-11 17:21:31 +0000157PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE(RunSmall, ToF32Fixture<float>, PRECOMMIT, SmallShapes(), F32, F32, scale_255, TO_NEAREST_UP, EmptyActivationFunctionsDataset, VALIDATE(float, 1.f))
158PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE(RunWithActivation, ToF32Fixture<float>, ALL, TinyShapes(), F32, F32, scale_255, TO_NEAREST_UP, ActivationFunctionsDataset, VALIDATE(float, 1.f))
Sheri Zhanga387e272021-06-29 17:34:06 +0100159FIXTURE_DATA_TEST_CASE(RunInplace, CLPixelWiseMultiplicationToF32Fixture<float>, framework::DatasetMode::PRECOMMIT,
160 combine(combine(combine(combine(combine(combine(combine(datasets::TinyShapes(),
161 framework::dataset::make("DataTypeIn1", DataType::F32)),
162 framework::dataset::make("DataTypeIn2", DataType::F32)),
163 framework::dataset::make("Scale", { scale_255 })),
164 datasets::ConvertPolicies()),
165 framework::dataset::make("RoundingPolicy", RoundingPolicy::TO_NEAREST_UP)),
166 EmptyActivationFunctionsDataset),
167 framework::dataset::make("InPlace", { true })))
168{
169 // Validate output
170 VALIDATE(float, 1.f)
171}
John Richardsondd715f22017-09-18 16:10:48 +0100172TEST_SUITE_END() // Scale255
John Richardsondd715f22017-09-18 16:10:48 +0100173TEST_SUITE_END() // F32toF32
174
Giorgio Arenadd2d0132021-04-22 14:34:15 +0100175PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE(RunSmallBroadcast, ToF32BroadcastFixture<float>, PRECOMMIT, SmallShapesBroadcast(), F32, F32, scale_255, TO_NEAREST_UP,
176 EmptyActivationFunctionsDataset,
Giorgio Arena8b2a7d32020-02-11 17:21:31 +0000177 VALIDATE(float, 1.f))
Giorgio Arenadd2d0132021-04-22 14:34:15 +0100178PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE(RunWithActivationSmallBroadcast, ToF32BroadcastFixture<float>, ALL, TinyShapesBroadcast(), F32, F32, scale_255, TO_NEAREST_UP,
179 ActivationFunctionsDataset,
Giorgio Arena8b2a7d32020-02-11 17:21:31 +0000180 VALIDATE(float, 1.f))
Georgios Pinitasbf28a3c2018-09-18 14:34:48 +0100181
182template <typename T>
Michele Di Giorgio7a0212a2020-04-14 16:08:32 +0100183using CLPixelWiseMultiplicationQuantizedFixture = PixelWiseMultiplicationValidationQuantizedFixture<CLTensor, CLAccessor, CLPixelWiseMultiplication, T, T>;
184using CLPixelWiseMultiplicationQSYMM16ToS32Fxture = PixelWiseMultiplicationValidationQuantizedFixture<CLTensor, CLAccessor, CLPixelWiseMultiplication, int16_t, int16_t, int32_t>;
Georgios Pinitasbf28a3c2018-09-18 14:34:48 +0100185
Giorgio Arenadd2d0132021-04-22 14:34:15 +0100186template <typename T>
187using CLPixelWiseMultiplicationQuantizedBroadcastFixture = PixelWiseMultiplicationBroadcastValidationQuantizedFixture<CLTensor, CLAccessor, CLPixelWiseMultiplication, T, T>;
188
Georgios Pinitasbf28a3c2018-09-18 14:34:48 +0100189TEST_SUITE(Quantized)
190TEST_SUITE(QASYMM8)
Michele Di Giorgio9428a182020-03-30 14:10:20 +0100191FIXTURE_DATA_TEST_CASE(RunSmall, CLPixelWiseMultiplicationQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT,
Sang-Hoon Park95a6f722020-06-19 15:31:29 +0100192 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(datasets::SmallShapes(),
193 framework::dataset::make("DataTypeIn1", DataType::QASYMM8)),
194 framework::dataset::make("DataTypeIn2", DataType::QASYMM8)),
195 framework::dataset::make("DataTypeOut", DataType::QASYMM8)),
196 framework::dataset::make("Scale", { 1.f, 2.f })),
197 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })),
198 framework::dataset::make("RoundingPolicy", RoundingPolicy::TO_NEAREST_EVEN)),
199 framework::dataset::make("Src0QInfo", { QuantizationInfo(5.f / 255.f, 20) })),
200 framework::dataset::make("Src1QInfo", { QuantizationInfo(2.f / 255.f, 10) })),
201 framework::dataset::make("OUtQInfo", { QuantizationInfo(1.f / 255.f, 5) })),
202 InPlaceDataSet))
Michele Di Giorgiod8a468f2019-06-19 15:34:41 +0100203{
204 // Validate output
205 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
206}
Giorgio Arenadd2d0132021-04-22 14:34:15 +0100207
208FIXTURE_DATA_TEST_CASE(RunSmallBroadcast, CLPixelWiseMultiplicationQuantizedBroadcastFixture<uint8_t>, framework::DatasetMode::PRECOMMIT,
209 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(datasets::SmallShapesBroadcast(),
210 framework::dataset::make("DataTypeIn1", DataType::QASYMM8)),
211 framework::dataset::make("DataTypeIn2", DataType::QASYMM8)),
212 framework::dataset::make("DataTypeOut", DataType::QASYMM8)),
213 framework::dataset::make("Scale", { 1.f, 2.f })),
214 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })),
215 framework::dataset::make("RoundingPolicy", RoundingPolicy::TO_NEAREST_EVEN)),
216 framework::dataset::make("Src0QInfo", { QuantizationInfo(5.f / 255.f, 20) })),
217 framework::dataset::make("Src1QInfo", { QuantizationInfo(2.f / 255.f, 10) })),
218 framework::dataset::make("OUtQInfo", { QuantizationInfo(1.f / 255.f, 5) })),
219 InPlaceDataSet))
220{
221 // Validate output
222 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
223}
224
Sheri Zhanga387e272021-06-29 17:34:06 +0100225FIXTURE_DATA_TEST_CASE(RunInplace, CLPixelWiseMultiplicationQuantizedBroadcastFixture<uint8_t>, framework::DatasetMode::PRECOMMIT,
226 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(datasets::TinyShapesBroadcastInplace(),
227 framework::dataset::make("DataTypeIn1", DataType::QASYMM8)),
228 framework::dataset::make("DataTypeIn2", DataType::QASYMM8)),
229 framework::dataset::make("DataTypeOut", DataType::QASYMM8)),
230 framework::dataset::make("Scale", { 1.f, 2.f })),
231 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })),
232 framework::dataset::make("RoundingPolicy", RoundingPolicy::TO_NEAREST_EVEN)),
233 framework::dataset::make("Src0QInfo", { QuantizationInfo(2.f / 255.f, 10) })),
234 framework::dataset::make("Src1QInfo", { QuantizationInfo(2.f / 255.f, 10) })),
235 framework::dataset::make("OUtQInfo", { QuantizationInfo(2.f / 255.f, 10) })),
236 framework::dataset::make("InPlace", { true })))
237{
238 // Validate output
239 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
240}
241
Michele Di Giorgiocbbed282019-12-20 13:26:08 +0000242TEST_SUITE_END() // QASYMM8
243
244TEST_SUITE(QASYMM8_SIGNED)
Michele Di Giorgio9428a182020-03-30 14:10:20 +0100245FIXTURE_DATA_TEST_CASE(RunSmall, CLPixelWiseMultiplicationQuantizedFixture<int8_t>, framework::DatasetMode::PRECOMMIT,
Sang-Hoon Park95a6f722020-06-19 15:31:29 +0100246 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(datasets::SmallShapes(),
247 framework::dataset::make("DataTypeIn1", DataType::QASYMM8_SIGNED)),
248 framework::dataset::make("DataTypeIn2", DataType::QASYMM8_SIGNED)),
249 framework::dataset::make("DataTypeOut", DataType::QASYMM8_SIGNED)),
250 framework::dataset::make("Scale", { 1.f, 2.f })),
251 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })),
252 framework::dataset::make("RoundingPolicy", RoundingPolicy::TO_NEAREST_EVEN)),
253 framework::dataset::make("Src0QInfo", { QuantizationInfo(5.f / 255.f, 20) })),
254 framework::dataset::make("Src1QInfo", { QuantizationInfo(2.f / 255.f, 10) })),
255 framework::dataset::make("OUtQInfo", { QuantizationInfo(1.f / 255.f, 5) })),
256 InPlaceDataSet))
Georgios Pinitasbf28a3c2018-09-18 14:34:48 +0100257{
258 // Validate output
259 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
260}
Michele Di Giorgiocbbed282019-12-20 13:26:08 +0000261TEST_SUITE_END() // QASYMM8_SIGNED
262
Michele Di Giorgiod8a468f2019-06-19 15:34:41 +0100263TEST_SUITE(QSYMM16)
Michele Di Giorgio9428a182020-03-30 14:10:20 +0100264FIXTURE_DATA_TEST_CASE(RunSmall, CLPixelWiseMultiplicationQuantizedFixture<int16_t>, framework::DatasetMode::PRECOMMIT,
Sang-Hoon Park95a6f722020-06-19 15:31:29 +0100265 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(datasets::SmallShapes(),
266 framework::dataset::make("DataTypeIn1", DataType::QSYMM16)),
267 framework::dataset::make("DataTypeIn2", DataType::QSYMM16)),
268 framework::dataset::make("DataTypeOut", DataType::QSYMM16)),
269 framework::dataset::make("Scale", { 1.f, 2.f })),
270 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })),
271 framework::dataset::make("RoundingPolicy", RoundingPolicy::TO_NEAREST_EVEN)),
272 framework::dataset::make("Src0QInfo", { QuantizationInfo(1.f / 32768.f, 0) })),
273 framework::dataset::make("Src1QInfo", { QuantizationInfo(2.f / 32768.f, 0) })),
274 framework::dataset::make("OutQInfo", { QuantizationInfo(5.f / 32768.f, 0) })),
275 InPlaceDataSet))
Michele Di Giorgiod8a468f2019-06-19 15:34:41 +0100276{
277 // Validate output
278 validate(CLAccessor(_target), _reference, tolerance_qsymm16);
279}
Michele Di Giorgio9428a182020-03-30 14:10:20 +0100280FIXTURE_DATA_TEST_CASE(RunLarge, CLPixelWiseMultiplicationQuantizedFixture<int16_t>, framework::DatasetMode::NIGHTLY,
Sang-Hoon Park95a6f722020-06-19 15:31:29 +0100281 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(datasets::LargeShapes(),
282 framework::dataset::make("DataTypeIn1", DataType::QSYMM16)),
283 framework::dataset::make("DataTypeIn2", DataType::QSYMM16)),
284 framework::dataset::make("DataTypeOut", DataType::QSYMM16)),
285 framework::dataset::make("Scale", { 1.f, 2.f })),
286 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })),
287 framework::dataset::make("RoundingPolicy", RoundingPolicy::TO_NEAREST_EVEN)),
288 framework::dataset::make("Src0QInfo", { QuantizationInfo(1.f / 32768.f, 0) })),
289 framework::dataset::make("Src1QInfo", { QuantizationInfo(2.f / 32768.f, 0) })),
290 framework::dataset::make("OutQInfo", { QuantizationInfo(5.f / 32768.f, 0) })),
291 InPlaceDataSet))
Michele Di Giorgiod8a468f2019-06-19 15:34:41 +0100292{
293 // Validate output
294 validate(CLAccessor(_target), _reference, tolerance_qsymm16);
295}
296TEST_SUITE_END() // QSYMM16
Michele Di Giorgio7a0212a2020-04-14 16:08:32 +0100297TEST_SUITE(QSYMM16ToS32)
298FIXTURE_DATA_TEST_CASE(RunSmall, CLPixelWiseMultiplicationQSYMM16ToS32Fxture, framework::DatasetMode::ALL,
Sang-Hoon Park95a6f722020-06-19 15:31:29 +0100299 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(datasets::SmallShapes(),
300 framework::dataset::make("DataTypeIn1", DataType::QSYMM16)),
301 framework::dataset::make("DataTypeIn2", DataType::QSYMM16)),
302 framework::dataset::make("DataTypeOut", DataType::S32)),
303 framework::dataset::make("Scale", { 1.f })),
304 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })),
305 framework::dataset::make("RoundingPolicy", RoundingPolicy::TO_NEAREST_EVEN)),
306 framework::dataset::make("Src0QInfo", { QuantizationInfo(1.f / 32768.f, 0) })),
307 framework::dataset::make("Src1QInfo", { QuantizationInfo(2.f / 32768.f, 0) })),
308 framework::dataset::make("OutQInfo", { QuantizationInfo(1.f, 0) })),
309 InPlaceDataSet))
Michele Di Giorgio7a0212a2020-04-14 16:08:32 +0100310{
311 // Validate output
312 validate(CLAccessor(_target), _reference, tolerance_qsymm16);
313}
314TEST_SUITE_END() // QSYMM16ToS32
Georgios Pinitasbf28a3c2018-09-18 14:34:48 +0100315TEST_SUITE_END() // Quantized
316
John Richardsondd715f22017-09-18 16:10:48 +0100317TEST_SUITE_END() // PixelWiseMultiplication
Georgios Pinitasbf28a3c2018-09-18 14:34:48 +0100318TEST_SUITE_END() // CL
John Richardsondd715f22017-09-18 16:10:48 +0100319} // namespace validation
320} // namespace test
321} // namespace arm_compute