Moritz Pflanzer | 572ade7 | 2017-07-21 17:36:33 +0100 | [diff] [blame] | 1 | /* |
Michele Di Giorgio | d9eaf61 | 2020-07-08 11:12:57 +0100 | [diff] [blame] | 2 | * Copyright (c) 2017-2020 Arm Limited. |
Moritz Pflanzer | 572ade7 | 2017-07-21 17:36:33 +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/core/Types.h" |
| 25 | #include "arm_compute/runtime/CL/CLTensor.h" |
| 26 | #include "arm_compute/runtime/CL/CLTensorAllocator.h" |
| 27 | #include "arm_compute/runtime/CL/functions/CLActivationLayer.h" |
Georgios Pinitas | 12833d0 | 2019-07-25 13:31:10 +0100 | [diff] [blame] | 28 | #include "arm_compute/runtime/RuntimeContext.h" |
Moritz Pflanzer | 572ade7 | 2017-07-21 17:36:33 +0100 | [diff] [blame] | 29 | #include "tests/CL/CLAccessor.h" |
| 30 | #include "tests/PaddingCalculator.h" |
Moritz Pflanzer | a09de0c | 2017-09-01 20:41:12 +0100 | [diff] [blame] | 31 | #include "tests/datasets/ActivationFunctionsDataset.h" |
| 32 | #include "tests/datasets/ShapeDatasets.h" |
| 33 | #include "tests/framework/Asserts.h" |
| 34 | #include "tests/framework/Macros.h" |
| 35 | #include "tests/framework/datasets/Datasets.h" |
| 36 | #include "tests/validation/Validation.h" |
| 37 | #include "tests/validation/fixtures/ActivationLayerFixture.h" |
Moritz Pflanzer | 572ade7 | 2017-07-21 17:36:33 +0100 | [diff] [blame] | 38 | |
| 39 | namespace arm_compute |
| 40 | { |
| 41 | namespace test |
| 42 | { |
| 43 | namespace validation |
| 44 | { |
| 45 | namespace |
| 46 | { |
Manuel Bottini | 30dbeef | 2019-06-26 16:23:03 +0100 | [diff] [blame] | 47 | constexpr AbsoluteTolerance<float> tolerance_qsymm16(1.f); |
| 48 | |
Moritz Pflanzer | 572ade7 | 2017-07-21 17:36:33 +0100 | [diff] [blame] | 49 | /** Define tolerance of the activation layer. |
| 50 | * |
| 51 | * @param[in] activation The activation function used. |
| 52 | * @param[in] data_type Data type. |
| 53 | * |
| 54 | * @return Tolerance depending on the activation function. |
| 55 | */ |
Moritz Pflanzer | 6106a4d | 2017-08-02 09:42:27 +0100 | [diff] [blame] | 56 | AbsoluteTolerance<float> tolerance(ActivationLayerInfo::ActivationFunction activation, DataType data_type) |
Moritz Pflanzer | 572ade7 | 2017-07-21 17:36:33 +0100 | [diff] [blame] | 57 | { |
Moritz Pflanzer | f07f145 | 2017-08-08 17:28:39 +0100 | [diff] [blame] | 58 | constexpr float epsilon = 1e-6f; |
Moritz Pflanzer | 6106a4d | 2017-08-02 09:42:27 +0100 | [diff] [blame] | 59 | |
Moritz Pflanzer | 572ade7 | 2017-07-21 17:36:33 +0100 | [diff] [blame] | 60 | switch(activation) |
| 61 | { |
| 62 | case ActivationLayerInfo::ActivationFunction::LINEAR: |
Moritz Pflanzer | 6106a4d | 2017-08-02 09:42:27 +0100 | [diff] [blame] | 63 | return AbsoluteTolerance<float>(data_type == DataType::F16 ? 0.2f : epsilon); |
Moritz Pflanzer | 572ade7 | 2017-07-21 17:36:33 +0100 | [diff] [blame] | 64 | case ActivationLayerInfo::ActivationFunction::SQUARE: |
Moritz Pflanzer | 6106a4d | 2017-08-02 09:42:27 +0100 | [diff] [blame] | 65 | return AbsoluteTolerance<float>(data_type == DataType::F16 ? 0.1f : epsilon); |
Moritz Pflanzer | 572ade7 | 2017-07-21 17:36:33 +0100 | [diff] [blame] | 66 | case ActivationLayerInfo::ActivationFunction::LOGISTIC: |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 67 | return AbsoluteTolerance<float>(data_type == DataType::F16 ? 0.001f : epsilon); |
Moritz Pflanzer | 572ade7 | 2017-07-21 17:36:33 +0100 | [diff] [blame] | 68 | case ActivationLayerInfo::ActivationFunction::LEAKY_RELU: |
Moritz Pflanzer | 6106a4d | 2017-08-02 09:42:27 +0100 | [diff] [blame] | 69 | return AbsoluteTolerance<float>(data_type == DataType::F16 ? 0.00001f : epsilon); |
Moritz Pflanzer | 572ade7 | 2017-07-21 17:36:33 +0100 | [diff] [blame] | 70 | case ActivationLayerInfo::ActivationFunction::SOFT_RELU: |
Georgios Pinitas | fb0fdcd | 2019-08-22 17:10:04 +0100 | [diff] [blame] | 71 | case ActivationLayerInfo::ActivationFunction::ELU: |
Moritz Pflanzer | 572ade7 | 2017-07-21 17:36:33 +0100 | [diff] [blame] | 72 | case ActivationLayerInfo::ActivationFunction::SQRT: |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 73 | return AbsoluteTolerance<float>(data_type == DataType::F16 ? 0.01f : 0.00001f); |
Moritz Pflanzer | 572ade7 | 2017-07-21 17:36:33 +0100 | [diff] [blame] | 74 | case ActivationLayerInfo::ActivationFunction::TANH: |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 75 | return AbsoluteTolerance<float>(data_type == DataType::F16 ? 0.001f : 0.00001f); |
morgolock | 6b3865a | 2020-03-04 14:57:46 +0000 | [diff] [blame] | 76 | case ActivationLayerInfo::ActivationFunction::HARD_SWISH: |
| 77 | return AbsoluteTolerance<float>(data_type == DataType::F16 ? 0.01f : epsilon); |
Moritz Pflanzer | 572ade7 | 2017-07-21 17:36:33 +0100 | [diff] [blame] | 78 | default: |
Moritz Pflanzer | 6106a4d | 2017-08-02 09:42:27 +0100 | [diff] [blame] | 79 | return AbsoluteTolerance<float>(epsilon); |
Moritz Pflanzer | 572ade7 | 2017-07-21 17:36:33 +0100 | [diff] [blame] | 80 | } |
| 81 | } |
| 82 | |
| 83 | /** CNN data types */ |
| 84 | const auto CNNDataTypes = framework::dataset::make("DataType", |
| 85 | { |
| 86 | DataType::F16, |
Vidhya Sudhan Loganathan | 0fc2545 | 2018-06-18 14:40:56 +0100 | [diff] [blame] | 87 | DataType::F32 |
Moritz Pflanzer | 572ade7 | 2017-07-21 17:36:33 +0100 | [diff] [blame] | 88 | }); |
| 89 | |
| 90 | /** Input data sets. */ |
| 91 | const auto ActivationDataset = combine(combine(framework::dataset::make("InPlace", { false, true }), datasets::ActivationFunctions()), framework::dataset::make("AlphaBeta", { 0.5f, 1.f })); |
Giorgio Arena | d304adb | 2020-10-02 10:20:11 +0100 | [diff] [blame] | 92 | |
| 93 | /** Zero padding test */ |
| 94 | bool validate_zero_padding(unsigned int width, unsigned int height, unsigned int channels, unsigned int batches, const ActivationLayerInfo &act_info, DataType data_type) |
| 95 | { |
| 96 | TensorShape shape(width, height, channels, batches); |
| 97 | |
| 98 | // Create tensors |
| 99 | CLTensor src = create_tensor<CLTensor>(shape, data_type); |
| 100 | CLTensor dst = create_tensor<CLTensor>(shape, data_type); |
| 101 | |
| 102 | src.info()->set_quantization_info(QuantizationInfo(1.f / 256.f, 0)); |
| 103 | dst.info()->set_quantization_info(QuantizationInfo(1.f / 256.f, 0)); |
| 104 | |
| 105 | ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 106 | ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 107 | |
| 108 | // Create and configure function |
| 109 | CLActivationLayer act; |
| 110 | act.configure(&src, &dst, act_info); |
| 111 | |
| 112 | // Padding can be added along rhs and bias's X dimension |
| 113 | return src.info()->padding().empty() && dst.info()->padding().empty(); |
| 114 | } |
Moritz Pflanzer | 572ade7 | 2017-07-21 17:36:33 +0100 | [diff] [blame] | 115 | } // namespace |
| 116 | |
| 117 | TEST_SUITE(CL) |
| 118 | TEST_SUITE(ActivationLayer) |
Georgios Pinitas | f9d3a0a | 2017-11-03 19:01:44 +0000 | [diff] [blame] | 119 | // *INDENT-OFF* |
| 120 | // clang-format off |
| 121 | DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip( |
| 122 | framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching data types |
Giorgio Arena | d304adb | 2020-10-02 10:20:11 +0100 | [diff] [blame] | 123 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), |
Giorgio Arena | 2995f5b | 2017-11-29 17:33:59 +0000 | [diff] [blame] | 124 | TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), |
| 125 | TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QASYMM8), |
Georgios Pinitas | 4b3fba1 | 2019-06-04 17:31:46 +0100 | [diff] [blame] | 126 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QASYMM8), // Invalid quantization info |
Georgios Pinitas | f9d3a0a | 2017-11-03 19:01:44 +0000 | [diff] [blame] | 127 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching shapes |
Manuel Bottini | 30dbeef | 2019-06-26 16:23:03 +0100 | [diff] [blame] | 128 | TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QSYMM16), |
| 129 | TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QSYMM16), |
| 130 | TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QSYMM16), // Invalid activation function for QSYMM16 |
Georgios Pinitas | f9d3a0a | 2017-11-03 19:01:44 +0000 | [diff] [blame] | 131 | }), |
| 132 | framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F16), |
| 133 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), |
Giorgio Arena | 2995f5b | 2017-11-29 17:33:59 +0000 | [diff] [blame] | 134 | TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), |
| 135 | TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QASYMM8), |
Georgios Pinitas | f9d3a0a | 2017-11-03 19:01:44 +0000 | [diff] [blame] | 136 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QASYMM8), |
| 137 | TensorInfo(TensorShape(30U, 11U, 2U), 1, DataType::F32), |
Manuel Bottini | 30dbeef | 2019-06-26 16:23:03 +0100 | [diff] [blame] | 138 | TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QSYMM16, QuantizationInfo(1.f / 32768.f, 0)), |
| 139 | TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QSYMM16, QuantizationInfo(1.f / 32768.f, 0)), |
| 140 | TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QSYMM16, QuantizationInfo(1.f / 32768.f, 0)), |
Georgios Pinitas | f9d3a0a | 2017-11-03 19:01:44 +0000 | [diff] [blame] | 141 | })), |
| 142 | framework::dataset::make("ActivationInfo", { ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), |
| 143 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), |
Giorgio Arena | 2995f5b | 2017-11-29 17:33:59 +0000 | [diff] [blame] | 144 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), |
Georgios Pinitas | f9d3a0a | 2017-11-03 19:01:44 +0000 | [diff] [blame] | 145 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU), |
Michele Di Giorgio | a1f7e33 | 2018-01-22 17:26:36 +0000 | [diff] [blame] | 146 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::TANH), |
Georgios Pinitas | f9d3a0a | 2017-11-03 19:01:44 +0000 | [diff] [blame] | 147 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), |
Manuel Bottini | 30dbeef | 2019-06-26 16:23:03 +0100 | [diff] [blame] | 148 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::TANH), |
| 149 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LOGISTIC), |
| 150 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::SQRT), |
Georgios Pinitas | f9d3a0a | 2017-11-03 19:01:44 +0000 | [diff] [blame] | 151 | })), |
Giorgio Arena | d304adb | 2020-10-02 10:20:11 +0100 | [diff] [blame] | 152 | framework::dataset::make("Expected", { false, true, true, true, false, false, true, true, false })), |
Georgios Pinitas | f9d3a0a | 2017-11-03 19:01:44 +0000 | [diff] [blame] | 153 | input_info, output_info, act_info, expected) |
| 154 | { |
Giorgio Arena | 2995f5b | 2017-11-29 17:33:59 +0000 | [diff] [blame] | 155 | ARM_COMPUTE_EXPECT(bool(CLActivationLayer::validate(&input_info.clone()->set_is_resizable(false), (output_info.total_size() == 0) ? nullptr : &output_info.clone()->set_is_resizable(false), act_info)) == expected, framework::LogLevel::ERRORS); |
Georgios Pinitas | f9d3a0a | 2017-11-03 19:01:44 +0000 | [diff] [blame] | 156 | } |
Giorgio Arena | d304adb | 2020-10-02 10:20:11 +0100 | [diff] [blame] | 157 | |
| 158 | /** Validate zero padding tests |
| 159 | * |
| 160 | * A series of validation tests to check that no padding is added as part of configuration for 4 different scenarios. |
| 161 | * |
| 162 | * Checks performed in order: |
| 163 | * - First dimension multiple of 16 |
| 164 | * - First dimension non-multiple of 16 |
| 165 | * - First dimension less than 16 (vec_size for qasymm8) but multiple |
| 166 | * - First dimension less than 16 (vec_size for qasymm8) non-multiple |
| 167 | * - Tensor with only one element |
| 168 | */ |
| 169 | DATA_TEST_CASE(ValidateZeroPadding, framework::DatasetMode::ALL, zip( |
| 170 | framework::dataset::make("Width", { 32U, 37U, 12U, 13U, 1U }), |
| 171 | framework::dataset::make("DataType", { DataType::F32, DataType::QASYMM8 })), |
| 172 | width, data_type) |
| 173 | { |
| 174 | const bool one_elem = (width == 1U); |
| 175 | bool status = validate_zero_padding(width, one_elem ? 1U : 17U, one_elem ? 1U : 7U, one_elem ? 1U : 2U, ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 1U, 6U), data_type); |
| 176 | ARM_COMPUTE_EXPECT(status, framework::LogLevel::ERRORS); |
| 177 | } |
Georgios Pinitas | f9d3a0a | 2017-11-03 19:01:44 +0000 | [diff] [blame] | 178 | // clang-format on |
| 179 | // *INDENT-ON* |
| 180 | |
Vidhya Sudhan Loganathan | d646ae1 | 2018-11-19 15:18:20 +0000 | [diff] [blame] | 181 | /** [CLActivationLayerFixture snippet] **/ |
Moritz Pflanzer | 572ade7 | 2017-07-21 17:36:33 +0100 | [diff] [blame] | 182 | template <typename T> |
| 183 | using CLActivationLayerFixture = ActivationValidationFixture<CLTensor, CLAccessor, CLActivationLayer, T>; |
Vidhya Sudhan Loganathan | d646ae1 | 2018-11-19 15:18:20 +0000 | [diff] [blame] | 184 | /** [CLActivationLayerFixture snippet] **/ |
Moritz Pflanzer | 572ade7 | 2017-07-21 17:36:33 +0100 | [diff] [blame] | 185 | |
| 186 | TEST_SUITE(Float) |
| 187 | TEST_SUITE(FP16) |
Vidhya Sudhan Loganathan | d646ae1 | 2018-11-19 15:18:20 +0000 | [diff] [blame] | 188 | /** [CLActivationLayer Test snippet] **/ |
Sang-Hoon Park | a8a7c1d | 2020-05-12 22:01:23 +0100 | [diff] [blame] | 189 | FIXTURE_DATA_TEST_CASE(RunSmall, CLActivationLayerFixture<half>, framework::DatasetMode::ALL, combine(combine(datasets::SmallShapes(), ActivationDataset), |
| 190 | framework::dataset::make("DataType", |
| 191 | DataType::F16))) |
Moritz Pflanzer | 572ade7 | 2017-07-21 17:36:33 +0100 | [diff] [blame] | 192 | { |
| 193 | // Validate output |
| 194 | validate(CLAccessor(_target), _reference, tolerance(_function, _data_type)); |
| 195 | } |
Vidhya Sudhan Loganathan | d646ae1 | 2018-11-19 15:18:20 +0000 | [diff] [blame] | 196 | /** [CLActivationLayer Test snippet] **/ |
Michalis Spyrou | 8094325 | 2019-01-10 17:19:50 +0000 | [diff] [blame] | 197 | TEST_SUITE_END() // FP16 |
Moritz Pflanzer | 572ade7 | 2017-07-21 17:36:33 +0100 | [diff] [blame] | 198 | |
| 199 | TEST_SUITE(FP32) |
Sang-Hoon Park | a8a7c1d | 2020-05-12 22:01:23 +0100 | [diff] [blame] | 200 | FIXTURE_DATA_TEST_CASE(RunSmall, CLActivationLayerFixture<float>, framework::DatasetMode::ALL, combine(combine(datasets::SmallShapes(), ActivationDataset), framework::dataset::make("DataType", |
| 201 | DataType::F32))) |
Moritz Pflanzer | 572ade7 | 2017-07-21 17:36:33 +0100 | [diff] [blame] | 202 | { |
| 203 | // Validate output |
| 204 | validate(CLAccessor(_target), _reference, tolerance(_function, _data_type)); |
| 205 | } |
Michalis Spyrou | 8094325 | 2019-01-10 17:19:50 +0000 | [diff] [blame] | 206 | TEST_SUITE_END() // FP32 |
| 207 | TEST_SUITE_END() // Float |
Moritz Pflanzer | 572ade7 | 2017-07-21 17:36:33 +0100 | [diff] [blame] | 208 | |
| 209 | template <typename T> |
Michel Iwaniec | 66cc12f | 2017-12-07 17:26:40 +0000 | [diff] [blame] | 210 | using CLActivationLayerQuantizedFixture = ActivationValidationQuantizedFixture<CLTensor, CLAccessor, CLActivationLayer, T>; |
| 211 | |
morgolock | 6b3865a | 2020-03-04 14:57:46 +0000 | [diff] [blame] | 212 | const auto QuantizedActivationDataset8 = combine(combine(framework::dataset::make("InPlace", { false }), |
| 213 | concat(datasets::ActivationFunctionsQuantized(), framework::dataset::make("ActivationFunction", ActivationLayerInfo::ActivationFunction::HARD_SWISH))), |
| 214 | framework::dataset::make("AlphaBeta", { 0.5f, 1.f })); |
| 215 | |
| 216 | const auto QuantizedActivationDataset16 = combine(combine(framework::dataset::make("InPlace", { false }), |
| 217 | datasets::ActivationFunctionsQuantized()), |
| 218 | framework::dataset::make("AlphaBeta", { 0.5f, 1.f })); |
Michel Iwaniec | 66cc12f | 2017-12-07 17:26:40 +0000 | [diff] [blame] | 219 | |
| 220 | TEST_SUITE(Quantized) |
| 221 | TEST_SUITE(QASYMM8) |
Sang-Hoon Park | a8a7c1d | 2020-05-12 22:01:23 +0100 | [diff] [blame] | 222 | FIXTURE_DATA_TEST_CASE(RunSmall, CLActivationLayerQuantizedFixture<uint8_t>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallShapes(), QuantizedActivationDataset8), |
| 223 | framework::dataset::make("DataType", |
| 224 | DataType::QASYMM8)), |
| 225 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.1f, 128.0f) }))) |
Michel Iwaniec | 66cc12f | 2017-12-07 17:26:40 +0000 | [diff] [blame] | 226 | { |
| 227 | // Validate output |
| 228 | validate(CLAccessor(_target), _reference, tolerance(_function, _data_type)); |
| 229 | } |
Michele Di Giorgio | cbbed28 | 2019-12-20 13:26:08 +0000 | [diff] [blame] | 230 | TEST_SUITE_END() // QASYMM8 |
| 231 | TEST_SUITE(QASYMM8_SIGNED) |
Sang-Hoon Park | a8a7c1d | 2020-05-12 22:01:23 +0100 | [diff] [blame] | 232 | FIXTURE_DATA_TEST_CASE(RunSmall, CLActivationLayerQuantizedFixture<int8_t>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallShapes(), QuantizedActivationDataset8), |
| 233 | framework::dataset::make("DataType", |
| 234 | DataType::QASYMM8_SIGNED)), |
| 235 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.1f, 10.0f) }))) |
Michel Iwaniec | 66cc12f | 2017-12-07 17:26:40 +0000 | [diff] [blame] | 236 | { |
| 237 | // Validate output |
| 238 | validate(CLAccessor(_target), _reference, tolerance(_function, _data_type)); |
| 239 | } |
Michele Di Giorgio | cbbed28 | 2019-12-20 13:26:08 +0000 | [diff] [blame] | 240 | TEST_SUITE_END() // QASYMM8_SIGNED |
Manuel Bottini | 30dbeef | 2019-06-26 16:23:03 +0100 | [diff] [blame] | 241 | TEST_SUITE(QSYMM16) |
Sang-Hoon Park | a8a7c1d | 2020-05-12 22:01:23 +0100 | [diff] [blame] | 242 | FIXTURE_DATA_TEST_CASE(RunSmall, CLActivationLayerQuantizedFixture<int16_t>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallShapes(), QuantizedActivationDataset16), |
| 243 | framework::dataset::make("DataType", |
| 244 | DataType::QSYMM16)), |
| 245 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(1.f / 32768.f, 0) }))) |
Manuel Bottini | 30dbeef | 2019-06-26 16:23:03 +0100 | [diff] [blame] | 246 | { |
| 247 | // Validate output |
| 248 | validate(CLAccessor(_target), _reference, tolerance_qsymm16); |
| 249 | } |
| 250 | TEST_SUITE_END() // QSYMM16 |
Michalis Spyrou | 8094325 | 2019-01-10 17:19:50 +0000 | [diff] [blame] | 251 | TEST_SUITE_END() // Quantized |
Michel Iwaniec | 66cc12f | 2017-12-07 17:26:40 +0000 | [diff] [blame] | 252 | |
Michalis Spyrou | 8094325 | 2019-01-10 17:19:50 +0000 | [diff] [blame] | 253 | TEST_SUITE_END() // ActivationLayer |
| 254 | TEST_SUITE_END() // CL |
Moritz Pflanzer | 572ade7 | 2017-07-21 17:36:33 +0100 | [diff] [blame] | 255 | } // namespace validation |
| 256 | } // namespace test |
| 257 | } // namespace arm_compute |