Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 1 | /* |
Dana Zlotnik | 6a2df88 | 2022-01-17 09:54:26 +0200 | [diff] [blame^] | 2 | * Copyright (c) 2017-2020, 2022 Arm Limited. |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +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/NESoftmaxLayer.h" |
| 26 | #include "arm_compute/runtime/Tensor.h" |
| 27 | #include "arm_compute/runtime/TensorAllocator.h" |
Dana Zlotnik | 6a2df88 | 2022-01-17 09:54:26 +0200 | [diff] [blame^] | 28 | #include "src/common/cpuinfo/CpuIsaInfo.h" |
| 29 | #include "src/cpu/kernels/CpuSoftmaxKernel.h" |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 30 | #include "tests/NEON/Accessor.h" |
| 31 | #include "tests/PaddingCalculator.h" |
Moritz Pflanzer | a09de0c | 2017-09-01 20:41:12 +0100 | [diff] [blame] | 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/SoftmaxLayerFixture.h" |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 38 | namespace arm_compute |
| 39 | { |
| 40 | namespace test |
| 41 | { |
| 42 | namespace validation |
| 43 | { |
| 44 | namespace |
| 45 | { |
| 46 | /** Tolerance for float operations */ |
Moritz Pflanzer | 6106a4d | 2017-08-02 09:42:27 +0100 | [diff] [blame] | 47 | constexpr AbsoluteTolerance<float> tolerance_f32(0.000001f); |
Manuel Bottini | 678d83a | 2019-01-07 16:05:36 +0000 | [diff] [blame] | 48 | RelativeTolerance<half> tolerance_f16(half(0.2)); |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 49 | |
Diego Lopez Recas | 35ceeb2 | 2017-12-04 18:56:10 +0000 | [diff] [blame] | 50 | /** Tolerance for quantized operations */ |
| 51 | constexpr AbsoluteTolerance<uint8_t> tolerance_qasymm8(1); |
Sang-Hoon Park | c3a7420 | 2019-11-22 16:05:46 +0000 | [diff] [blame] | 52 | constexpr AbsoluteTolerance<int8_t> tolerance_qasymm8_signed(1); |
Diego Lopez Recas | 35ceeb2 | 2017-12-04 18:56:10 +0000 | [diff] [blame] | 53 | |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 54 | /** CNN data types */ |
| 55 | const auto CNNDataTypes = framework::dataset::make("DataType", |
| 56 | { |
Ioan-Cristian Szabo | 5edbd1c | 2017-11-13 13:34:08 +0000 | [diff] [blame] | 57 | #ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 58 | DataType::F16, |
Ioan-Cristian Szabo | 5edbd1c | 2017-11-13 13:34:08 +0000 | [diff] [blame] | 59 | #endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */ |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 60 | DataType::F32, |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 61 | }); |
| 62 | } // namespace |
| 63 | |
| 64 | TEST_SUITE(NEON) |
| 65 | TEST_SUITE(SoftmaxLayer) |
Michalis Spyrou | afa5d81 | 2017-11-30 14:25:57 +0000 | [diff] [blame] | 66 | // *INDENT-OFF* |
| 67 | // clang-format off |
Manuel Bottini | 678d83a | 2019-01-07 16:05:36 +0000 | [diff] [blame] | 68 | DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip( |
| 69 | framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U), 1, DataType::F32), // Mismatching data types |
| 70 | TensorInfo(TensorShape(27U, 13U), 1, DataType::F32), // Mismatching shapes |
| 71 | TensorInfo(TensorShape(27U, 13U), 1, DataType::QASYMM8, // Invalid output quantization info |
| 72 | QuantizationInfo(1.f/256, 12)), |
Manuel Bottini | 678d83a | 2019-01-07 16:05:36 +0000 | [diff] [blame] | 73 | TensorInfo(TensorShape(32U, 13U), 1, DataType::F32), |
| 74 | TensorInfo(TensorShape(32U, 13U), 1, DataType::QASYMM8, |
| 75 | QuantizationInfo(1.f/256, 12)), |
SiCong Li | 96209c7 | 2020-08-21 12:28:30 +0100 | [diff] [blame] | 76 | TensorInfo(TensorShape(32U, 13U), 1, DataType::F32), |
SiCong Li | d004a7a | 2020-05-28 15:26:41 +0100 | [diff] [blame] | 77 | TensorInfo(TensorShape(32U, 13U), 1, DataType::QASYMM8, //Invalid axis high |
| 78 | QuantizationInfo(1.f/256, 12)), |
| 79 | TensorInfo(TensorShape(32U, 13U), 1, DataType::QASYMM8, //Invalid axis low |
Manuel Bottini | 678d83a | 2019-01-07 16:05:36 +0000 | [diff] [blame] | 80 | QuantizationInfo(1.f/256, 12)), |
| 81 | }), |
| 82 | framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(27U, 13U), 1, DataType::F16), |
| 83 | TensorInfo(TensorShape(27U, 11U), 1, DataType::F32), |
| 84 | TensorInfo(TensorShape(27U, 13U), 1, DataType::QASYMM8, |
| 85 | QuantizationInfo(1.f/256, 12)), |
Manuel Bottini | 678d83a | 2019-01-07 16:05:36 +0000 | [diff] [blame] | 86 | TensorInfo(TensorShape(32U, 13U), 1, DataType::F32), |
| 87 | TensorInfo(TensorShape(32U, 13U), 1, DataType::QASYMM8, |
| 88 | QuantizationInfo(1.f/256, 0)), |
SiCong Li | 96209c7 | 2020-08-21 12:28:30 +0100 | [diff] [blame] | 89 | TensorInfo(TensorShape(32U, 13U), 1, DataType::F32), |
Manuel Bottini | 678d83a | 2019-01-07 16:05:36 +0000 | [diff] [blame] | 90 | TensorInfo(TensorShape(32U, 13U), 1, DataType::QASYMM8, |
| 91 | QuantizationInfo(1.f/256, 0)), |
SiCong Li | d004a7a | 2020-05-28 15:26:41 +0100 | [diff] [blame] | 92 | TensorInfo(TensorShape(32U, 13U), 1, DataType::QASYMM8, |
| 93 | QuantizationInfo(1.f/256, 0)), |
Manuel Bottini | 678d83a | 2019-01-07 16:05:36 +0000 | [diff] [blame] | 94 | })), |
| 95 | framework::dataset::make("beta", { 1.0, |
| 96 | 2.0, |
| 97 | 1.0, |
| 98 | 2.0, |
| 99 | 1.0, |
SiCong Li | 96209c7 | 2020-08-21 12:28:30 +0100 | [diff] [blame] | 100 | 1.0, |
Manuel Bottini | 678d83a | 2019-01-07 16:05:36 +0000 | [diff] [blame] | 101 | 2.0, |
| 102 | 1.0, |
Manuel Bottini | 678d83a | 2019-01-07 16:05:36 +0000 | [diff] [blame] | 103 | })), |
morgolock | 9c7fed8 | 2020-08-05 12:30:56 +0100 | [diff] [blame] | 104 | framework::dataset::make("axis", { 0, |
SiCong Li | d004a7a | 2020-05-28 15:26:41 +0100 | [diff] [blame] | 105 | 0, |
| 106 | 0, |
SiCong Li | 96209c7 | 2020-08-21 12:28:30 +0100 | [diff] [blame] | 107 | 1, |
morgolock | 9c7fed8 | 2020-08-05 12:30:56 +0100 | [diff] [blame] | 108 | 0, |
SiCong Li | 96209c7 | 2020-08-21 12:28:30 +0100 | [diff] [blame] | 109 | -1, |
SiCong Li | d004a7a | 2020-05-28 15:26:41 +0100 | [diff] [blame] | 110 | 2, |
Sheri Zhang | 1f567af | 2020-05-05 11:47:36 +0100 | [diff] [blame] | 111 | -3, |
Manuel Bottini | 678d83a | 2019-01-07 16:05:36 +0000 | [diff] [blame] | 112 | })), |
SiCong Li | 96209c7 | 2020-08-21 12:28:30 +0100 | [diff] [blame] | 113 | framework::dataset::make("Expected", { false, false, false, true, true, true, false, false })), |
morgolock | 9c7fed8 | 2020-08-05 12:30:56 +0100 | [diff] [blame] | 114 | input_info, output_info, beta, axis, expected) |
Michalis Spyrou | afa5d81 | 2017-11-30 14:25:57 +0000 | [diff] [blame] | 115 | { |
morgolock | 9c7fed8 | 2020-08-05 12:30:56 +0100 | [diff] [blame] | 116 | ARM_COMPUTE_EXPECT(bool(NESoftmaxLayer::validate(&input_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), beta, axis)) == expected, framework::LogLevel::ERRORS); |
Michalis Spyrou | afa5d81 | 2017-11-30 14:25:57 +0000 | [diff] [blame] | 117 | } |
| 118 | // clang-format on |
| 119 | // *INDENT-ON* |
| 120 | |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 121 | template <typename T> |
| 122 | using NESoftmaxLayerFixture = SoftmaxValidationFixture<Tensor, Accessor, NESoftmaxLayer, T>; |
| 123 | |
Dana Zlotnik | 6a2df88 | 2022-01-17 09:54:26 +0200 | [diff] [blame^] | 124 | DATA_TEST_CASE(KernelSelection_max_logits, framework::DatasetMode::ALL, concat( |
| 125 | combine(framework::dataset::make("CpuExt", std::string("NEON")), |
| 126 | framework::dataset::make("DataType", { DataType::F32, |
| 127 | DataType::F16, |
| 128 | DataType::QASYMM8, |
| 129 | DataType::QASYMM8_SIGNED |
| 130 | })), |
| 131 | combine(framework::dataset::make("CpuExt", std::string("SVE")), |
| 132 | framework::dataset::make("DataType", { DataType::F32, |
| 133 | DataType::F16, |
| 134 | DataType::QASYMM8, |
| 135 | DataType::QASYMM8_SIGNED |
| 136 | }))), |
| 137 | cpu_ext, data_type) |
| 138 | { |
| 139 | using namespace cpu::kernels; |
| 140 | |
| 141 | cpuinfo::CpuIsaInfo cpu_isa{}; |
| 142 | cpu_isa.neon = (cpu_ext == "NEON"); |
| 143 | cpu_isa.sve = (cpu_ext == "SVE"); |
| 144 | cpu_isa.fp16 = (data_type == DataType::F16); |
| 145 | |
| 146 | const auto *selected_impl = CpuLogits1DMaxKernel::get_implementation(DataTypeISASelectorData{ data_type, cpu_isa }, cpu::KernelSelectionType::Preferred); |
| 147 | |
| 148 | ARM_COMPUTE_ERROR_ON_NULLPTR(selected_impl); |
| 149 | |
| 150 | std::string expected = lower_string(cpu_ext) + "_" + cpu_impl_dt(data_type) + "_logits_1d_max"; |
| 151 | std::string actual = selected_impl->name; |
| 152 | |
| 153 | ARM_COMPUTE_EXPECT_EQUAL(expected, actual, framework::LogLevel::ERRORS); |
| 154 | } |
| 155 | |
| 156 | DATA_TEST_CASE(KernelSelection_logits, framework::DatasetMode::ALL, concat(concat( |
| 157 | combine(framework::dataset::make("CpuExt", std::string("NEON")), |
| 158 | framework::dataset::make("DataType", { DataType::F32, |
| 159 | DataType::F16, |
| 160 | DataType::QASYMM8, |
| 161 | DataType::QASYMM8_SIGNED |
| 162 | })), |
| 163 | combine(framework::dataset::make("CpuExt", std::string("SVE")), |
| 164 | framework::dataset::make("DataType", { DataType::F32, |
| 165 | DataType::F16 |
| 166 | }))), |
| 167 | combine(framework::dataset::make("CpuExt", std::string("SVE2")), |
| 168 | framework::dataset::make("DataType", { DataType::QASYMM8, |
| 169 | DataType::QASYMM8_SIGNED |
| 170 | }))), |
| 171 | cpu_ext, data_type) |
| 172 | { |
| 173 | using namespace cpu::kernels; |
| 174 | |
| 175 | cpuinfo::CpuIsaInfo cpu_isa{}; |
| 176 | cpu_isa.neon = (cpu_ext == "NEON"); |
| 177 | cpu_isa.sve = (cpu_ext == "SVE"); |
| 178 | cpu_isa.sve2 = (cpu_ext == "SVE2"); |
| 179 | cpu_isa.fp16 = (data_type == DataType::F16); |
| 180 | |
| 181 | const auto *selected_impl = CpuLogits1DSoftmaxKernel<false>::get_implementation(DataTypeISASelectorData{ data_type, cpu_isa }, cpu::KernelSelectionType::Preferred); |
| 182 | |
| 183 | ARM_COMPUTE_ERROR_ON_NULLPTR(selected_impl); |
| 184 | |
| 185 | std::string expected = lower_string(cpu_ext) + "_" + cpu_impl_dt(data_type) + "_softmax_logits_1d"; |
| 186 | std::string actual = selected_impl->name; |
| 187 | |
| 188 | ARM_COMPUTE_EXPECT_EQUAL(expected, actual, framework::LogLevel::ERRORS); |
| 189 | } |
| 190 | |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 191 | TEST_SUITE(Float) |
Ioan-Cristian Szabo | 5edbd1c | 2017-11-13 13:34:08 +0000 | [diff] [blame] | 192 | #ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 193 | TEST_SUITE(FP16) |
Manuel Bottini | 678d83a | 2019-01-07 16:05:36 +0000 | [diff] [blame] | 194 | FIXTURE_DATA_TEST_CASE(RunSmall, NESoftmaxLayerFixture<half>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::Small4DShapes(), |
Pablo Palmier | a2b89ca | 2017-10-05 15:01:34 +0100 | [diff] [blame] | 195 | framework::dataset::make("DataType", DataType::F16)), |
giuros01 | efbf6c8 | 2018-09-03 09:53:53 +0100 | [diff] [blame] | 196 | framework::dataset::make("Beta", { 1.0f, 2.0f })), |
SiCong Li | 96209c7 | 2020-08-21 12:28:30 +0100 | [diff] [blame] | 197 | framework::dataset::make("Axis", { 0, 1 }))) |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 198 | { |
| 199 | // Validate output |
Manuel Bottini | 678d83a | 2019-01-07 16:05:36 +0000 | [diff] [blame] | 200 | validate(Accessor(_target), _reference, tolerance_f16); |
| 201 | } |
| 202 | FIXTURE_DATA_TEST_CASE(RunSmall4D, NESoftmaxLayerFixture<half>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::Small4DShapes(), |
Manuel Bottini | 21079dd | 2019-10-29 17:20:09 +0000 | [diff] [blame] | 203 | framework::dataset::make("DataType", DataType::F16)), |
Manuel Bottini | 678d83a | 2019-01-07 16:05:36 +0000 | [diff] [blame] | 204 | framework::dataset::make("Beta", { 1.0f, 2.0f })), |
SiCong Li | 96209c7 | 2020-08-21 12:28:30 +0100 | [diff] [blame] | 205 | framework::dataset::make("Axis", { 0, 2, -1 }))) |
Manuel Bottini | 678d83a | 2019-01-07 16:05:36 +0000 | [diff] [blame] | 206 | { |
| 207 | // Validate output |
Manuel Bottini | 21079dd | 2019-10-29 17:20:09 +0000 | [diff] [blame] | 208 | validate(Accessor(_target), _reference, tolerance_f16); |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 209 | } |
giuros01 | efbf6c8 | 2018-09-03 09:53:53 +0100 | [diff] [blame] | 210 | FIXTURE_DATA_TEST_CASE(RunLarge, NESoftmaxLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::SoftmaxLayerLargeShapes(), |
| 211 | framework::dataset::make("DataType", DataType::F16)), |
| 212 | framework::dataset::make("Beta", { 1.0f, 2.0f })), |
morgolock | 9c7fed8 | 2020-08-05 12:30:56 +0100 | [diff] [blame] | 213 | framework::dataset::make("Axis", { 0 }))) |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 214 | { |
| 215 | // Validate output |
Manuel Bottini | 678d83a | 2019-01-07 16:05:36 +0000 | [diff] [blame] | 216 | validate(Accessor(_target), _reference, tolerance_f16); |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 217 | } |
Manuel Bottini | 678d83a | 2019-01-07 16:05:36 +0000 | [diff] [blame] | 218 | TEST_SUITE_END() //FP16 |
| 219 | #endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */ |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 220 | |
| 221 | TEST_SUITE(FP32) |
Manuel Bottini | 678d83a | 2019-01-07 16:05:36 +0000 | [diff] [blame] | 222 | FIXTURE_DATA_TEST_CASE(RunSmall2D, NESoftmaxLayerFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SoftmaxLayerSmallShapes(), |
| 223 | framework::dataset::make("DataType", DataType::F32)), |
| 224 | framework::dataset::make("Beta", { 1.0f, 2.0f })), |
SiCong Li | 96209c7 | 2020-08-21 12:28:30 +0100 | [diff] [blame] | 225 | framework::dataset::make("Axis", { 0, -1 }))) |
Manuel Bottini | 678d83a | 2019-01-07 16:05:36 +0000 | [diff] [blame] | 226 | { |
| 227 | // Validate output |
| 228 | validate(Accessor(_target), _reference, tolerance_f32); |
| 229 | } |
| 230 | FIXTURE_DATA_TEST_CASE(RunSmall4D, NESoftmaxLayerFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::Small4DShapes(), |
| 231 | framework::dataset::make("DataType", DataType::F32)), |
| 232 | framework::dataset::make("Beta", { 1.0f, 2.0f })), |
SiCong Li | 96209c7 | 2020-08-21 12:28:30 +0100 | [diff] [blame] | 233 | framework::dataset::make("Axis", { 0, -2, 3 }))) |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 234 | { |
| 235 | // Validate output |
| 236 | validate(Accessor(_target), _reference, tolerance_f32); |
| 237 | } |
giuros01 | efbf6c8 | 2018-09-03 09:53:53 +0100 | [diff] [blame] | 238 | FIXTURE_DATA_TEST_CASE(RunLarge, NESoftmaxLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::SoftmaxLayerLargeShapes(), |
| 239 | framework::dataset::make("DataType", DataType::F32)), |
| 240 | framework::dataset::make("Beta", { 1.0f, 2.0f })), |
morgolock | 9c7fed8 | 2020-08-05 12:30:56 +0100 | [diff] [blame] | 241 | framework::dataset::make("Axis", { 0 }))) |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 242 | { |
| 243 | // Validate output |
| 244 | validate(Accessor(_target), _reference, tolerance_f32); |
| 245 | } |
Manuel Bottini | 678d83a | 2019-01-07 16:05:36 +0000 | [diff] [blame] | 246 | TEST_SUITE_END() //FP32 |
| 247 | TEST_SUITE_END() //Float |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 248 | |
| 249 | template <typename T> |
Diego Lopez Recas | 35ceeb2 | 2017-12-04 18:56:10 +0000 | [diff] [blame] | 250 | using NESoftmaxLayerQuantizedFixture = SoftmaxValidationQuantizedFixture<Tensor, Accessor, NESoftmaxLayer, T>; |
| 251 | |
| 252 | TEST_SUITE(Quantized) |
| 253 | TEST_SUITE(QASYMM8) |
Manuel Bottini | 678d83a | 2019-01-07 16:05:36 +0000 | [diff] [blame] | 254 | FIXTURE_DATA_TEST_CASE(RunSmall2D, NESoftmaxLayerQuantizedFixture<uint8_t>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SoftmaxLayerSmallShapes(), |
| 255 | framework::dataset::make("DataType", DataType::QASYMM8)), |
| 256 | combine(framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, -10) }), |
| 257 | framework::dataset::make("Beta", { 1.0f, 2.f }))), |
SiCong Li | 96209c7 | 2020-08-21 12:28:30 +0100 | [diff] [blame] | 258 | framework::dataset::make("Axis", { 0, -1 }))) |
Manuel Bottini | 678d83a | 2019-01-07 16:05:36 +0000 | [diff] [blame] | 259 | { |
| 260 | // Validate output |
| 261 | validate(Accessor(_target), _reference, tolerance_qasymm8); |
| 262 | } |
| 263 | FIXTURE_DATA_TEST_CASE(RunSmall4D, NESoftmaxLayerQuantizedFixture<uint8_t>, framework::DatasetMode::ALL, combine(combine(combine(datasets::Small4DShapes(), |
| 264 | framework::dataset::make("DataType", DataType::QASYMM8)), |
| 265 | combine(framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, -10) }), |
| 266 | framework::dataset::make("Beta", { 1.0f, 2.f }))), |
SiCong Li | 96209c7 | 2020-08-21 12:28:30 +0100 | [diff] [blame] | 267 | framework::dataset::make("Axis", { 0, 1, -2 }))) |
Diego Lopez Recas | 35ceeb2 | 2017-12-04 18:56:10 +0000 | [diff] [blame] | 268 | { |
| 269 | // Validate output |
| 270 | validate(Accessor(_target), _reference, tolerance_qasymm8); |
| 271 | } |
giuros01 | efbf6c8 | 2018-09-03 09:53:53 +0100 | [diff] [blame] | 272 | FIXTURE_DATA_TEST_CASE(RunLarge, NESoftmaxLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::SoftmaxLayerLargeShapes(), |
Diego Lopez Recas | 35ceeb2 | 2017-12-04 18:56:10 +0000 | [diff] [blame] | 273 | framework::dataset::make("DataType", DataType::QASYMM8)), |
| 274 | combine(framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, -10) }), |
giuros01 | efbf6c8 | 2018-09-03 09:53:53 +0100 | [diff] [blame] | 275 | framework::dataset::make("Beta", { 1.0f, 2.0f }))), |
morgolock | 9c7fed8 | 2020-08-05 12:30:56 +0100 | [diff] [blame] | 276 | framework::dataset::make("Axis", { 0 }))) |
Diego Lopez Recas | 35ceeb2 | 2017-12-04 18:56:10 +0000 | [diff] [blame] | 277 | { |
| 278 | // Validate output |
| 279 | validate(Accessor(_target), _reference, tolerance_qasymm8); |
| 280 | } |
Manuel Bottini | 678d83a | 2019-01-07 16:05:36 +0000 | [diff] [blame] | 281 | TEST_SUITE_END() //QASYMM8 |
Sang-Hoon Park | c3a7420 | 2019-11-22 16:05:46 +0000 | [diff] [blame] | 282 | |
| 283 | TEST_SUITE(QASYMM8_SIGNED) |
| 284 | FIXTURE_DATA_TEST_CASE(RunSmall2D, NESoftmaxLayerQuantizedFixture<int8_t>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SoftmaxLayerSmallShapes(), |
| 285 | framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)), |
| 286 | combine(framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, -10) }), |
| 287 | framework::dataset::make("Beta", { 1.0f, 2.f }))), |
SiCong Li | 96209c7 | 2020-08-21 12:28:30 +0100 | [diff] [blame] | 288 | framework::dataset::make("Axis", { 0, -1 }))) |
Sang-Hoon Park | c3a7420 | 2019-11-22 16:05:46 +0000 | [diff] [blame] | 289 | { |
| 290 | // Validate output |
| 291 | validate(Accessor(_target), _reference, tolerance_qasymm8_signed); |
| 292 | } |
| 293 | FIXTURE_DATA_TEST_CASE(RunSmall4D, NESoftmaxLayerQuantizedFixture<int8_t>, framework::DatasetMode::ALL, combine(combine(combine(datasets::Small4DShapes(), |
| 294 | framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)), |
| 295 | combine(framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, -10) }), |
| 296 | framework::dataset::make("Beta", { 1.0f, 2.f }))), |
SiCong Li | 96209c7 | 2020-08-21 12:28:30 +0100 | [diff] [blame] | 297 | framework::dataset::make("Axis", { 0, 1, -1 }))) |
Sang-Hoon Park | c3a7420 | 2019-11-22 16:05:46 +0000 | [diff] [blame] | 298 | { |
| 299 | // Validate output |
| 300 | validate(Accessor(_target), _reference, tolerance_qasymm8_signed); |
| 301 | } |
| 302 | TEST_SUITE_END() //QASYMM8_SIGNED |
| 303 | |
Manuel Bottini | 678d83a | 2019-01-07 16:05:36 +0000 | [diff] [blame] | 304 | TEST_SUITE_END() //Quantized |
giuros01 | efbf6c8 | 2018-09-03 09:53:53 +0100 | [diff] [blame] | 305 | |
Manuel Bottini | 678d83a | 2019-01-07 16:05:36 +0000 | [diff] [blame] | 306 | TEST_SUITE_END() //SoftmaxLayer |
| 307 | TEST_SUITE_END() //NEON |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 308 | } // namespace validation |
| 309 | } // namespace test |
| 310 | } // namespace arm_compute |