Michele Di Giorgio | 4e09b38 | 2017-07-05 18:20:02 +0100 | [diff] [blame] | 1 | /* |
Mohammed Suhail Munshi | 0a48c4c | 2024-01-30 18:25:51 +0000 | [diff] [blame^] | 2 | * Copyright (c) 2017-2021, 2024 Arm Limited. |
Michele Di Giorgio | 4e09b38 | 2017-07-05 18:20:02 +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/NEON/functions/NEQuantizationLayer.h" |
| 26 | #include "arm_compute/runtime/Tensor.h" |
| 27 | #include "arm_compute/runtime/TensorAllocator.h" |
Michele Di Giorgio | 4e09b38 | 2017-07-05 18:20:02 +0100 | [diff] [blame] | 28 | #include "tests/NEON/Accessor.h" |
| 29 | #include "tests/PaddingCalculator.h" |
Moritz Pflanzer | a09de0c | 2017-09-01 20:41:12 +0100 | [diff] [blame] | 30 | #include "tests/datasets/ShapeDatasets.h" |
| 31 | #include "tests/framework/Asserts.h" |
| 32 | #include "tests/framework/Macros.h" |
| 33 | #include "tests/framework/datasets/Datasets.h" |
| 34 | #include "tests/validation/Validation.h" |
| 35 | #include "tests/validation/fixtures/QuantizationLayerFixture.h" |
Michele Di Giorgio | 4e09b38 | 2017-07-05 18:20:02 +0100 | [diff] [blame] | 36 | |
Mohammed Suhail Munshi | 0a48c4c | 2024-01-30 18:25:51 +0000 | [diff] [blame^] | 37 | |
Michele Di Giorgio | 4e09b38 | 2017-07-05 18:20:02 +0100 | [diff] [blame] | 38 | namespace arm_compute |
| 39 | { |
| 40 | namespace test |
| 41 | { |
| 42 | namespace validation |
| 43 | { |
| 44 | namespace |
| 45 | { |
| 46 | /** Tolerance for quantization */ |
Manuel Bottini | 4370cff | 2020-02-07 16:31:59 +0000 | [diff] [blame] | 47 | constexpr AbsoluteTolerance<uint8_t> tolerance_u8(1); /**< Tolerance value for comparing reference's output against implementation's output for QASYMM8 data types */ |
| 48 | constexpr AbsoluteTolerance<int8_t> tolerance_s8(1); /**< Tolerance value for comparing reference's output against implementation's output for QASYMM8_SIGNED data types */ |
| 49 | constexpr AbsoluteTolerance<uint16_t> tolerance_u16(1); /**< Tolerance value for comparing reference's output against implementation's output for QASYMM16 data types */ |
| 50 | const auto QuantizationSmallShapes = concat(datasets::Small3DShapes(), datasets::Small4DShapes()); |
| 51 | const auto QuantizationLargeShapes = concat(datasets::Large3DShapes(), datasets::Large4DShapes()); |
Michele Di Giorgio | 4e09b38 | 2017-07-05 18:20:02 +0100 | [diff] [blame] | 52 | } // namespace |
| 53 | |
| 54 | TEST_SUITE(NEON) |
| 55 | TEST_SUITE(QuantizationLayer) |
| 56 | |
Michalis Spyrou | aeebe4a | 2019-01-09 14:21:03 +0000 | [diff] [blame] | 57 | // *INDENT-OFF* |
| 58 | // clang-format off |
| 59 | DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip( |
Manuel Bottini | 4370cff | 2020-02-07 16:31:59 +0000 | [diff] [blame] | 60 | framework::dataset::make("InputInfo", { TensorInfo(TensorShape(16U, 16U, 16U, 5U), 1, DataType::QASYMM8), // Wrong output data type |
Michalis Spyrou | aeebe4a | 2019-01-09 14:21:03 +0000 | [diff] [blame] | 61 | TensorInfo(TensorShape(16U, 16U, 16U, 5U), 1, DataType::F32), // Wrong output data type |
John Kesapides | adfb273 | 2019-03-04 16:29:22 +0000 | [diff] [blame] | 62 | TensorInfo(TensorShape(16U, 16U, 2U, 5U), 1, DataType::F32), // Missmatching shapes |
Michalis Spyrou | aeebe4a | 2019-01-09 14:21:03 +0000 | [diff] [blame] | 63 | TensorInfo(TensorShape(16U, 16U, 16U, 5U), 1, DataType::F32), // Valid |
| 64 | }), |
| 65 | framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(16U, 16U, 16U, 5U), 1, DataType::F32), |
Michalis Spyrou | aeebe4a | 2019-01-09 14:21:03 +0000 | [diff] [blame] | 66 | TensorInfo(TensorShape(16U, 16U, 16U, 5U), 1, DataType::U16), |
John Kesapides | adfb273 | 2019-03-04 16:29:22 +0000 | [diff] [blame] | 67 | TensorInfo(TensorShape(16U, 16U, 16U, 5U), 1, DataType::QASYMM8), |
| 68 | TensorInfo(TensorShape(16U, 16U, 16U, 5U), 1, DataType::QASYMM8), |
Michalis Spyrou | aeebe4a | 2019-01-09 14:21:03 +0000 | [diff] [blame] | 69 | })), |
John Kesapides | adfb273 | 2019-03-04 16:29:22 +0000 | [diff] [blame] | 70 | framework::dataset::make("Expected", { false, false, false, true})), |
Michalis Spyrou | aeebe4a | 2019-01-09 14:21:03 +0000 | [diff] [blame] | 71 | input_info, output_info, expected) |
| 72 | { |
| 73 | ARM_COMPUTE_EXPECT(bool(NEQuantizationLayer::validate(&input_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false))) == expected, framework::LogLevel::ERRORS); |
| 74 | } |
| 75 | // clang-format on |
| 76 | // *INDENT-ON* |
| 77 | |
Michele Di Giorgio | 4e09b38 | 2017-07-05 18:20:02 +0100 | [diff] [blame] | 78 | template <typename T> |
Michele Di Giorgio | d87a7b2 | 2019-09-10 10:42:27 +0100 | [diff] [blame] | 79 | using NEQuantizationLayerQASYMM8Fixture = QuantizationValidationFixture<Tensor, Accessor, NEQuantizationLayer, T, uint8_t>; |
Michele Di Giorgio | d64a46c | 2019-10-01 12:25:49 +0100 | [diff] [blame] | 80 | template <typename T> |
Sang-Hoon Park | fb6aaeb | 2019-11-27 15:26:44 +0000 | [diff] [blame] | 81 | using NEQuantizationLayerQASYMM8SignedFixture = QuantizationValidationFixture<Tensor, Accessor, NEQuantizationLayer, T, int8_t>; |
| 82 | template <typename T> |
Michele Di Giorgio | d64a46c | 2019-10-01 12:25:49 +0100 | [diff] [blame] | 83 | using NEQuantizationLayerQASYMM16Fixture = QuantizationValidationFixture<Tensor, Accessor, NEQuantizationLayer, T, uint16_t>; |
Michele Di Giorgio | 4e09b38 | 2017-07-05 18:20:02 +0100 | [diff] [blame] | 84 | |
| 85 | TEST_SUITE(Float) |
| 86 | TEST_SUITE(FP32) |
Michele Di Giorgio | d87a7b2 | 2019-09-10 10:42:27 +0100 | [diff] [blame] | 87 | FIXTURE_DATA_TEST_CASE(RunSmallQASYMM8, NEQuantizationLayerQASYMM8Fixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(QuantizationSmallShapes, |
| 88 | framework::dataset::make("DataType", DataType::F32)), |
| 89 | framework::dataset::make("DataTypeOut", { DataType::QASYMM8 })), |
| 90 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) }))) |
Michele Di Giorgio | 4e09b38 | 2017-07-05 18:20:02 +0100 | [diff] [blame] | 91 | { |
| 92 | // Validate output |
| 93 | validate(Accessor(_target), _reference, tolerance_u8); |
| 94 | } |
Sang-Hoon Park | fb6aaeb | 2019-11-27 15:26:44 +0000 | [diff] [blame] | 95 | FIXTURE_DATA_TEST_CASE(RunSmallQASYMM8Signed, NEQuantizationLayerQASYMM8SignedFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(QuantizationSmallShapes, |
| 96 | framework::dataset::make("DataType", DataType::F32)), |
| 97 | framework::dataset::make("DataTypeOut", { DataType::QASYMM8_SIGNED })), |
| 98 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) }))) |
| 99 | { |
| 100 | // Validate output |
Georgios Pinitas | d30405a | 2021-01-13 14:42:54 +0000 | [diff] [blame] | 101 | validate(Accessor(_target), _reference, tolerance_s8); |
Sang-Hoon Park | fb6aaeb | 2019-11-27 15:26:44 +0000 | [diff] [blame] | 102 | } |
Michele Di Giorgio | d64a46c | 2019-10-01 12:25:49 +0100 | [diff] [blame] | 103 | FIXTURE_DATA_TEST_CASE(RunSmallQASYMM16, NEQuantizationLayerQASYMM16Fixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(QuantizationSmallShapes, |
| 104 | framework::dataset::make("DataType", DataType::F32)), |
| 105 | framework::dataset::make("DataTypeOut", { DataType::QASYMM16 })), |
| 106 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) }))) |
| 107 | { |
| 108 | // Validate output |
| 109 | validate(Accessor(_target), _reference, tolerance_u16); |
| 110 | } |
Michele Di Giorgio | d87a7b2 | 2019-09-10 10:42:27 +0100 | [diff] [blame] | 111 | FIXTURE_DATA_TEST_CASE(RunLargeQASYMM8, NEQuantizationLayerQASYMM8Fixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(QuantizationLargeShapes, |
| 112 | framework::dataset::make("DataType", DataType::F32)), |
| 113 | framework::dataset::make("DataTypeOut", { DataType::QASYMM8 })), |
| 114 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) }))) |
Michele Di Giorgio | 4e09b38 | 2017-07-05 18:20:02 +0100 | [diff] [blame] | 115 | { |
| 116 | // Validate output |
| 117 | validate(Accessor(_target), _reference, tolerance_u8); |
| 118 | } |
Michele Di Giorgio | d64a46c | 2019-10-01 12:25:49 +0100 | [diff] [blame] | 119 | FIXTURE_DATA_TEST_CASE(RunLargeQASYMM16, NEQuantizationLayerQASYMM16Fixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(QuantizationLargeShapes, |
| 120 | framework::dataset::make("DataType", DataType::F32)), |
| 121 | framework::dataset::make("DataTypeOut", { DataType::QASYMM16 })), |
| 122 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) }))) |
| 123 | { |
| 124 | // Validate output |
| 125 | validate(Accessor(_target), _reference, tolerance_u16); |
| 126 | } |
Michalis Spyrou | aeebe4a | 2019-01-09 14:21:03 +0000 | [diff] [blame] | 127 | TEST_SUITE_END() // FP32 |
John Kesapides | adfb273 | 2019-03-04 16:29:22 +0000 | [diff] [blame] | 128 | #ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC |
John Kesapides | adfb273 | 2019-03-04 16:29:22 +0000 | [diff] [blame] | 129 | TEST_SUITE(FP16) |
Michele Di Giorgio | d87a7b2 | 2019-09-10 10:42:27 +0100 | [diff] [blame] | 130 | FIXTURE_DATA_TEST_CASE(RunSmallQASYMM8, NEQuantizationLayerQASYMM8Fixture<half>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(QuantizationSmallShapes, |
| 131 | framework::dataset::make("DataType", DataType::F16)), |
| 132 | framework::dataset::make("DataTypeOut", { DataType::QASYMM8 })), |
| 133 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) }))) |
John Kesapides | adfb273 | 2019-03-04 16:29:22 +0000 | [diff] [blame] | 134 | { |
| 135 | // Validate output |
| 136 | validate(Accessor(_target), _reference, tolerance_u8); |
| 137 | } |
Sang-Hoon Park | fb6aaeb | 2019-11-27 15:26:44 +0000 | [diff] [blame] | 138 | FIXTURE_DATA_TEST_CASE(RunSmallQASYMM8Signed, NEQuantizationLayerQASYMM8SignedFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(QuantizationSmallShapes, |
| 139 | framework::dataset::make("DataType", DataType::F16)), |
| 140 | framework::dataset::make("DataTypeOut", { DataType::QASYMM8_SIGNED })), |
| 141 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) }))) |
| 142 | { |
| 143 | // Validate output |
Georgios Pinitas | d30405a | 2021-01-13 14:42:54 +0000 | [diff] [blame] | 144 | validate(Accessor(_target), _reference, tolerance_s8); |
Sang-Hoon Park | fb6aaeb | 2019-11-27 15:26:44 +0000 | [diff] [blame] | 145 | } |
Michele Di Giorgio | d64a46c | 2019-10-01 12:25:49 +0100 | [diff] [blame] | 146 | FIXTURE_DATA_TEST_CASE(RunSmallQASYMM16, NEQuantizationLayerQASYMM16Fixture<half>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(QuantizationSmallShapes, |
| 147 | framework::dataset::make("DataType", DataType::F16)), |
| 148 | framework::dataset::make("DataTypeOut", { DataType::QASYMM16 })), |
| 149 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) }))) |
| 150 | { |
| 151 | // Validate output |
| 152 | validate(Accessor(_target), _reference, tolerance_u16); |
| 153 | } |
Michele Di Giorgio | d87a7b2 | 2019-09-10 10:42:27 +0100 | [diff] [blame] | 154 | FIXTURE_DATA_TEST_CASE(RunLargeQASYMM8, NEQuantizationLayerQASYMM8Fixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(QuantizationLargeShapes, |
| 155 | framework::dataset::make("DataType", DataType::F16)), |
| 156 | framework::dataset::make("DataTypeOut", { DataType::QASYMM8 })), |
| 157 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) }))) |
John Kesapides | adfb273 | 2019-03-04 16:29:22 +0000 | [diff] [blame] | 158 | { |
| 159 | // Validate output |
| 160 | validate(Accessor(_target), _reference, tolerance_u8); |
| 161 | } |
Michele Di Giorgio | d64a46c | 2019-10-01 12:25:49 +0100 | [diff] [blame] | 162 | FIXTURE_DATA_TEST_CASE(RunLargeQASYMM16, NEQuantizationLayerQASYMM16Fixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(QuantizationLargeShapes, |
| 163 | framework::dataset::make("DataType", DataType::F16)), |
| 164 | framework::dataset::make("DataTypeOut", { DataType::QASYMM16 })), |
| 165 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) }))) |
| 166 | { |
| 167 | // Validate output |
| 168 | validate(Accessor(_target), _reference, tolerance_u16); |
| 169 | } |
John Kesapides | adfb273 | 2019-03-04 16:29:22 +0000 | [diff] [blame] | 170 | TEST_SUITE_END() // FP16 |
John Kesapides | adfb273 | 2019-03-04 16:29:22 +0000 | [diff] [blame] | 171 | #endif // __ARM_FEATURE_FP16_VECTOR_ARITHMETIC |
Michele Di Giorgio | d64a46c | 2019-10-01 12:25:49 +0100 | [diff] [blame] | 172 | TEST_SUITE_END() // Float |
Michele Di Giorgio | 4e09b38 | 2017-07-05 18:20:02 +0100 | [diff] [blame] | 173 | |
Manuel Bottini | 4370cff | 2020-02-07 16:31:59 +0000 | [diff] [blame] | 174 | TEST_SUITE(Quantized) |
| 175 | template <typename T> |
| 176 | using NEQuantizationLayerQASYMM8GenFixture = QuantizationValidationGenericFixture<Tensor, Accessor, NEQuantizationLayer, T, uint8_t>; |
| 177 | template <typename T> |
| 178 | using NEQuantizationLayerQASYMM8_SIGNEDGenFixture = QuantizationValidationGenericFixture<Tensor, Accessor, NEQuantizationLayer, T, int8_t>; |
| 179 | template <typename T> |
| 180 | using NEQuantizationLayerQASYMM16GenFixture = QuantizationValidationGenericFixture<Tensor, Accessor, NEQuantizationLayer, T, uint16_t>; |
| 181 | TEST_SUITE(QASYMM8) |
| 182 | FIXTURE_DATA_TEST_CASE(RunSmallQASYMM8, NEQuantizationLayerQASYMM8GenFixture<uint8_t>, framework::DatasetMode::ALL, combine(combine(combine(combine(QuantizationSmallShapes, |
| 183 | framework::dataset::make("DataType", DataType::QASYMM8)), |
| 184 | framework::dataset::make("DataTypeOut", { DataType::QASYMM8 })), |
| 185 | framework::dataset::make("QuantizationInfoOutput", { QuantizationInfo(0.5f, 10) })), |
Mohammed Suhail Munshi | 0a48c4c | 2024-01-30 18:25:51 +0000 | [diff] [blame^] | 186 | framework::dataset::make("QuantizationInfoInput", { QuantizationInfo(2.0f, 15), QuantizationInfo(0.5f, 25) }))) |
| 187 | { |
| 188 | // Validate output |
| 189 | validate(Accessor(_target), _reference, tolerance_u8); |
| 190 | } |
| 191 | FIXTURE_DATA_TEST_CASE(ConvertUint8toInt8, NEQuantizationLayerQASYMM8GenFixture<uint8_t>, framework::DatasetMode::ALL, combine(combine(combine(combine(QuantizationSmallShapes, |
| 192 | framework::dataset::make("DataType", DataType::QASYMM8)), |
| 193 | framework::dataset::make("DataTypeOut", { DataType::QASYMM8_SIGNED })), |
| 194 | framework::dataset::make("QuantizationInfoOutput", { QuantizationInfo(2.0f, -1) })), |
| 195 | framework::dataset::make("QuantizationInfoInput", { QuantizationInfo(2.0f, 127) }))) |
Manuel Bottini | 4370cff | 2020-02-07 16:31:59 +0000 | [diff] [blame] | 196 | { |
| 197 | // Validate output |
| 198 | validate(Accessor(_target), _reference, tolerance_u8); |
| 199 | } |
| 200 | FIXTURE_DATA_TEST_CASE(RunSmallQASYMM8_SIGNED, NEQuantizationLayerQASYMM8_SIGNEDGenFixture<uint8_t>, framework::DatasetMode::ALL, combine(combine(combine(combine(QuantizationSmallShapes, |
| 201 | framework::dataset::make("DataTypeIn", DataType::QASYMM8)), |
| 202 | framework::dataset::make("DataTypeOut", { DataType::QASYMM8_SIGNED })), |
| 203 | framework::dataset::make("QuantizationInfoOutput", { QuantizationInfo(1.0f, 10), QuantizationInfo(2.0f, -25) })), |
Mohammed Suhail Munshi | 0a48c4c | 2024-01-30 18:25:51 +0000 | [diff] [blame^] | 204 | framework::dataset::make("QuantizationInfoInput", { QuantizationInfo(1.0f, 15), QuantizationInfo(1.0f, 127) }))) |
Manuel Bottini | 4370cff | 2020-02-07 16:31:59 +0000 | [diff] [blame] | 205 | { |
| 206 | // Validate output |
| 207 | validate(Accessor(_target), _reference, tolerance_s8); |
| 208 | } |
| 209 | FIXTURE_DATA_TEST_CASE(RunSmallQASYMM16, NEQuantizationLayerQASYMM16GenFixture<uint8_t>, framework::DatasetMode::ALL, combine(combine(combine(combine(QuantizationSmallShapes, |
| 210 | framework::dataset::make("DataTypeIn", DataType::QASYMM8)), |
| 211 | framework::dataset::make("DataTypeOut", { DataType::QASYMM16 })), |
| 212 | framework::dataset::make("QuantizationInfoOutput", { QuantizationInfo(1.0f, 10) })), |
| 213 | framework::dataset::make("QuantizationInfoInput", { QuantizationInfo(4.0f, 23) }))) |
| 214 | { |
| 215 | // Validate output |
| 216 | validate(Accessor(_target), _reference, tolerance_u16); |
| 217 | } |
| 218 | TEST_SUITE_END() // QASYMM8 |
| 219 | TEST_SUITE(QASYMM8_SIGNED) |
| 220 | FIXTURE_DATA_TEST_CASE(RunSmallQASYMM8_SIGNED, NEQuantizationLayerQASYMM8_SIGNEDGenFixture<int8_t>, framework::DatasetMode::ALL, combine(combine(combine(combine(QuantizationSmallShapes, |
| 221 | framework::dataset::make("DataTypeIn", DataType::QASYMM8_SIGNED)), |
| 222 | framework::dataset::make("DataTypeOut", { DataType::QASYMM8_SIGNED })), |
| 223 | framework::dataset::make("QuantizationInfoOutput", { QuantizationInfo(1.0f, 10) })), |
Mohammed Suhail Munshi | 0a48c4c | 2024-01-30 18:25:51 +0000 | [diff] [blame^] | 224 | framework::dataset::make("QuantizationInfoInput", { QuantizationInfo(2.0f, -5), QuantizationInfo(1.0f, 43) }))) |
Manuel Bottini | 4370cff | 2020-02-07 16:31:59 +0000 | [diff] [blame] | 225 | { |
| 226 | // Validate output |
| 227 | validate(Accessor(_target), _reference, tolerance_s8); |
| 228 | } |
| 229 | FIXTURE_DATA_TEST_CASE(RunSmallQASYMM8, NEQuantizationLayerQASYMM8GenFixture<int8_t>, framework::DatasetMode::ALL, combine(combine(combine(combine(QuantizationSmallShapes, |
| 230 | framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)), |
| 231 | framework::dataset::make("DataTypeOut", { DataType::QASYMM8 })), |
| 232 | framework::dataset::make("QuantizationInfoOutput", { QuantizationInfo(2.0f, 10), QuantizationInfo(2.0f, -25) })), |
Mohammed Suhail Munshi | 0a48c4c | 2024-01-30 18:25:51 +0000 | [diff] [blame^] | 233 | framework::dataset::make("QuantizationInfoInput", { QuantizationInfo(1.0f, 30), QuantizationInfo(2.0f, -128) }))) |
Manuel Bottini | 4370cff | 2020-02-07 16:31:59 +0000 | [diff] [blame] | 234 | { |
| 235 | // Validate output |
| 236 | validate(Accessor(_target), _reference, tolerance_u8); |
| 237 | } |
Mohammed Suhail Munshi | 0a48c4c | 2024-01-30 18:25:51 +0000 | [diff] [blame^] | 238 | FIXTURE_DATA_TEST_CASE(ConvertInt8toUint8, NEQuantizationLayerQASYMM8_SIGNEDGenFixture<int8_t>, framework::DatasetMode::ALL, combine(combine(combine(combine(QuantizationSmallShapes, |
| 239 | framework::dataset::make("DataTypeIn", DataType::QASYMM8_SIGNED)), |
| 240 | framework::dataset::make("DataTypeOut", { DataType::QASYMM8 })), |
| 241 | framework::dataset::make("QuantizationInfoOutput", { QuantizationInfo(1.0f, 0) })), |
| 242 | framework::dataset::make("QuantizationInfoInput", { QuantizationInfo(1.0f, -128) }))) |
| 243 | { |
| 244 | // Validate output |
| 245 | validate(Accessor(_target), _reference, tolerance_s8); |
| 246 | } |
| 247 | |
Manuel Bottini | 4370cff | 2020-02-07 16:31:59 +0000 | [diff] [blame] | 248 | TEST_SUITE_END() // QASYMM8_SIGNED |
| 249 | TEST_SUITE_END() // Quantized |
| 250 | |
Michalis Spyrou | aeebe4a | 2019-01-09 14:21:03 +0000 | [diff] [blame] | 251 | TEST_SUITE_END() // QuantizationLayer |
Sheri Zhang | ac6499a | 2021-02-10 15:32:38 +0000 | [diff] [blame] | 252 | TEST_SUITE_END() // Neon |
Michele Di Giorgio | 4e09b38 | 2017-07-05 18:20:02 +0100 | [diff] [blame] | 253 | } // namespace validation |
| 254 | } // namespace test |
| 255 | } // namespace arm_compute |