Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 1 | /* |
Sang-Hoon Park | d0c9cb8 | 2021-03-11 15:29:19 +0000 | [diff] [blame] | 2 | * Copyright (c) 2017-2021 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/CL/CLTensor.h" |
| 26 | #include "arm_compute/runtime/CL/CLTensorAllocator.h" |
| 27 | #include "arm_compute/runtime/CL/functions/CLSoftmaxLayer.h" |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 28 | #include "tests/CL/CLAccessor.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/SoftmaxLayerFixture.h" |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 36 | |
Sang-Hoon Park | d0c9cb8 | 2021-03-11 15:29:19 +0000 | [diff] [blame] | 37 | #include "arm_compute/runtime/MemoryManagerOnDemand.h" |
| 38 | #include "arm_compute/runtime/PoolManager.h" |
| 39 | #include "arm_compute/runtime/BlobLifetimeManager.h" |
| 40 | #include "arm_compute/runtime/CL/CLBufferAllocator.h" |
| 41 | #include "arm_compute/runtime/BlobMemoryPool.h" |
| 42 | |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 43 | namespace arm_compute |
| 44 | { |
| 45 | namespace test |
| 46 | { |
| 47 | namespace validation |
| 48 | { |
| 49 | namespace |
| 50 | { |
| 51 | /** Tolerance for float operations */ |
Georgios Pinitas | 583137c | 2017-08-31 18:12:42 +0100 | [diff] [blame] | 52 | RelativeTolerance<half> tolerance_f16(half(0.2)); |
| 53 | RelativeTolerance<float> tolerance_f32(0.001f); |
steniu01 | 3e05e4e | 2017-08-25 17:18:01 +0100 | [diff] [blame] | 54 | |
Chunosov | f450caa | 2017-11-08 16:09:35 +0700 | [diff] [blame] | 55 | /** Tolerance for quantized operations */ |
| 56 | constexpr AbsoluteTolerance<uint8_t> tolerance_qasymm8(1); |
Sang-Hoon Park | 0779fec | 2019-11-13 17:08:12 +0000 | [diff] [blame] | 57 | constexpr AbsoluteTolerance<int8_t> tolerance_qasymm8_signed(1); |
| 58 | |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 59 | /** CNN data types */ |
| 60 | const auto CNNDataTypes = framework::dataset::make("DataType", |
| 61 | { |
Chunosov | f450caa | 2017-11-08 16:09:35 +0700 | [diff] [blame] | 62 | DataType::QASYMM8, |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 63 | DataType::F16, |
| 64 | DataType::F32, |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 65 | }); |
| 66 | } // namespace |
| 67 | |
| 68 | TEST_SUITE(CL) |
| 69 | TEST_SUITE(SoftmaxLayer) |
| 70 | |
Sang-Hoon Park | d0c9cb8 | 2021-03-11 15:29:19 +0000 | [diff] [blame] | 71 | TEST_CASE(SimpleMemoryManaged, framework::DatasetMode::ALL) |
| 72 | { |
| 73 | // The purpose of this test is to test if the function can |
| 74 | // run correctly even with the given memory manager from its caller |
| 75 | // (Similar scenario when the library is integrated into other software) |
| 76 | // especially when working with workspace() method of |
| 77 | // @ref arm_compute::opencl::ClSoftmax. |
| 78 | const auto shape = TensorShape{4,2}; // Random shape, not important |
| 79 | constexpr auto dt = DataType::F32; // Random data type, not important |
| 80 | |
| 81 | // Create a memory manager |
| 82 | auto lm = std::make_shared<BlobLifetimeManager>(); |
| 83 | auto pm = std::make_shared<arm_compute::PoolManager>(); |
| 84 | auto alloc = std::make_unique<CLBufferAllocator>(); |
| 85 | auto mm = std::make_shared<MemoryManagerOnDemand>(lm, pm); |
| 86 | |
| 87 | auto src = create_tensor<CLTensor>(shape, dt); |
| 88 | auto dst = create_tensor<CLTensor>(shape, dt); |
| 89 | src.allocator()->allocate(); |
| 90 | dst.allocator()->allocate(); |
| 91 | |
| 92 | // Create the function with the memory manager |
| 93 | CLSoftmaxLayer smx(mm); |
| 94 | smx.configure(&src, &dst); |
| 95 | |
| 96 | // Populate the memory, acquire() will happen in run() |
| 97 | mm->populate(*alloc.get(), 1); |
| 98 | |
| 99 | std::vector<float> input_vals{0.0f, 1.0f, 0.0f, 0.0f, 0.5f, 0.0f, 0.0f, 0.0f,}; |
| 100 | library->fill_static_values(CLAccessor(src), input_vals); |
| 101 | |
| 102 | smx.run(); |
| 103 | |
| 104 | // Compute reference to compare |
| 105 | SimpleTensor<float> ref_src{shape, dt}; |
| 106 | library->fill_static_values(ref_src, input_vals); |
| 107 | auto ref_dst = reference::softmax_layer<float>(ref_src, 1., 0, false); |
| 108 | |
| 109 | validate(CLAccessor(dst), ref_dst); |
| 110 | } |
| 111 | |
Georgios Pinitas | 30902ed | 2017-11-14 15:32:57 +0000 | [diff] [blame] | 112 | // *INDENT-OFF* |
| 113 | // clang-format off |
SiCong Li | d004a7a | 2020-05-28 15:26:41 +0100 | [diff] [blame] | 114 | DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip( |
Georgios Pinitas | 17d6d3c | 2018-07-02 17:52:40 +0100 | [diff] [blame] | 115 | framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U), 1, DataType::F32), // Mismatching data types |
| 116 | TensorInfo(TensorShape(27U, 13U), 1, DataType::F32), // Mismatching shapes |
| 117 | TensorInfo(TensorShape(27U, 13U), 1, DataType::QASYMM8, // Invalid output quantization info |
Georgios Pinitas | 30902ed | 2017-11-14 15:32:57 +0000 | [diff] [blame] | 118 | QuantizationInfo(1.f/256, 12)), |
Georgios Pinitas | 17d6d3c | 2018-07-02 17:52:40 +0100 | [diff] [blame] | 119 | TensorInfo(TensorShape(32U, 13U), 1, DataType::F32), |
| 120 | TensorInfo(TensorShape(32U, 13U), 1, DataType::QASYMM8, |
Georgios Pinitas | 30902ed | 2017-11-14 15:32:57 +0000 | [diff] [blame] | 121 | QuantizationInfo(1.f/256, 12)), |
Sang-Hoon Park | 0779fec | 2019-11-13 17:08:12 +0000 | [diff] [blame] | 122 | TensorInfo(TensorShape(32U, 13U), 1, DataType::QASYMM8_SIGNED, |
SiCong Li | d004a7a | 2020-05-28 15:26:41 +0100 | [diff] [blame] | 123 | QuantizationInfo(1.f/256, 12)), |
| 124 | TensorInfo(TensorShape(32U, 13U), 1, DataType::QASYMM8_SIGNED, // Invalid axis high |
| 125 | QuantizationInfo(1.f/256, 12)), |
| 126 | TensorInfo(TensorShape(32U, 13U), 1, DataType::QASYMM8_SIGNED, // Invalid axis low |
Sang-Hoon Park | 0779fec | 2019-11-13 17:08:12 +0000 | [diff] [blame] | 127 | QuantizationInfo(1.f/256, 12)) |
Georgios Pinitas | 30902ed | 2017-11-14 15:32:57 +0000 | [diff] [blame] | 128 | }), |
Georgios Pinitas | 17d6d3c | 2018-07-02 17:52:40 +0100 | [diff] [blame] | 129 | framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(27U, 13U), 1, DataType::F16), |
| 130 | TensorInfo(TensorShape(27U, 11U), 1, DataType::F32), |
| 131 | TensorInfo(TensorShape(27U, 13U), 1, DataType::QASYMM8, |
Georgios Pinitas | 30902ed | 2017-11-14 15:32:57 +0000 | [diff] [blame] | 132 | QuantizationInfo(1.f/256, 12)), |
Georgios Pinitas | 17d6d3c | 2018-07-02 17:52:40 +0100 | [diff] [blame] | 133 | TensorInfo(TensorShape(32U, 13U), 1, DataType::F32), |
| 134 | TensorInfo(TensorShape(32U, 13U), 1, DataType::QASYMM8, |
Georgios Pinitas | 30902ed | 2017-11-14 15:32:57 +0000 | [diff] [blame] | 135 | QuantizationInfo(1.f/256, 0)), |
Sang-Hoon Park | 0779fec | 2019-11-13 17:08:12 +0000 | [diff] [blame] | 136 | TensorInfo(TensorShape(32U, 13U), 1, DataType::QASYMM8_SIGNED, |
| 137 | QuantizationInfo(1.f/256, -128)), |
SiCong Li | 96209c7 | 2020-08-21 12:28:30 +0100 | [diff] [blame] | 138 | TensorInfo(TensorShape(32U, 13U), 1, DataType::QASYMM8_SIGNED, |
SiCong Li | d004a7a | 2020-05-28 15:26:41 +0100 | [diff] [blame] | 139 | QuantizationInfo(1.f/256, -128)), |
SiCong Li | 96209c7 | 2020-08-21 12:28:30 +0100 | [diff] [blame] | 140 | TensorInfo(TensorShape(32U, 13U), 1, DataType::QASYMM8_SIGNED, |
SiCong Li | d004a7a | 2020-05-28 15:26:41 +0100 | [diff] [blame] | 141 | QuantizationInfo(1.f/256, -128)), |
Georgios Pinitas | 30902ed | 2017-11-14 15:32:57 +0000 | [diff] [blame] | 142 | })), |
SiCong Li | d004a7a | 2020-05-28 15:26:41 +0100 | [diff] [blame] | 143 | framework::dataset::make("beta", { 1.0, |
| 144 | 2.0, |
| 145 | 1.0, |
| 146 | 2.0, |
| 147 | 1.0, |
| 148 | 2.0, |
| 149 | 1.0, |
| 150 | 2.0, |
SiCong Li | d004a7a | 2020-05-28 15:26:41 +0100 | [diff] [blame] | 151 | })), |
morgolock | 9c7fed8 | 2020-08-05 12:30:56 +0100 | [diff] [blame] | 152 | framework::dataset::make("axis", { |
SiCong Li | d004a7a | 2020-05-28 15:26:41 +0100 | [diff] [blame] | 153 | 0, |
| 154 | 0, |
| 155 | 0, |
SiCong Li | 96209c7 | 2020-08-21 12:28:30 +0100 | [diff] [blame] | 156 | 1, |
morgolock | 9c7fed8 | 2020-08-05 12:30:56 +0100 | [diff] [blame] | 157 | 0, |
SiCong Li | d004a7a | 2020-05-28 15:26:41 +0100 | [diff] [blame] | 158 | -1, |
SiCong Li | 96209c7 | 2020-08-21 12:28:30 +0100 | [diff] [blame] | 159 | 2, |
| 160 | -3, |
SiCong Li | d004a7a | 2020-05-28 15:26:41 +0100 | [diff] [blame] | 161 | })), |
Giorgio Arena | 2d1a835 | 2020-10-26 15:04:08 +0000 | [diff] [blame] | 162 | framework::dataset::make("Expected", { false, false, false, true, true, true, false, false })), |
morgolock | 9c7fed8 | 2020-08-05 12:30:56 +0100 | [diff] [blame] | 163 | input_info, output_info, beta, axis, expected) |
Georgios Pinitas | 30902ed | 2017-11-14 15:32:57 +0000 | [diff] [blame] | 164 | { |
morgolock | 9c7fed8 | 2020-08-05 12:30:56 +0100 | [diff] [blame] | 165 | ARM_COMPUTE_EXPECT(bool(CLSoftmaxLayer::validate(&input_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), beta, axis)) == expected, framework::LogLevel::ERRORS); |
Georgios Pinitas | 30902ed | 2017-11-14 15:32:57 +0000 | [diff] [blame] | 166 | } |
| 167 | // clang-format on |
| 168 | // *INDENT-ON* |
| 169 | |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 170 | template <typename T> |
| 171 | using CLSoftmaxLayerFixture = SoftmaxValidationFixture<CLTensor, CLAccessor, CLSoftmaxLayer, T>; |
| 172 | |
| 173 | TEST_SUITE(Float) |
| 174 | TEST_SUITE(FP16) |
giuros01 | efbf6c8 | 2018-09-03 09:53:53 +0100 | [diff] [blame] | 175 | FIXTURE_DATA_TEST_CASE(RunSmall, CLSoftmaxLayerFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SoftmaxLayerSmallShapes(), |
| 176 | framework::dataset::make("DataType", DataType::F16)), |
| 177 | framework::dataset::make("Beta", { 1.0f, 2.0f })), |
SiCong Li | 96209c7 | 2020-08-21 12:28:30 +0100 | [diff] [blame] | 178 | framework::dataset::make("Axis", { 0, -1 }))) |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 179 | { |
| 180 | // Validate output |
| 181 | validate(CLAccessor(_target), _reference, tolerance_f16); |
| 182 | } |
giuros01 | efbf6c8 | 2018-09-03 09:53:53 +0100 | [diff] [blame] | 183 | FIXTURE_DATA_TEST_CASE(RunLarge, CLSoftmaxLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::SoftmaxLayerLargeShapes(), |
| 184 | framework::dataset::make("DataType", DataType::F16)), |
| 185 | framework::dataset::make("Beta", { 1.0f, 2.0f })), |
morgolock | 9c7fed8 | 2020-08-05 12:30:56 +0100 | [diff] [blame] | 186 | framework::dataset::make("Axis", { 0 }))) |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 187 | { |
| 188 | // Validate output |
| 189 | validate(CLAccessor(_target), _reference, tolerance_f16); |
| 190 | } |
giuros01 | efbf6c8 | 2018-09-03 09:53:53 +0100 | [diff] [blame] | 191 | FIXTURE_DATA_TEST_CASE(Run4D, CLSoftmaxLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::SoftmaxLayer4DShapes(), |
| 192 | framework::dataset::make("DataType", DataType::F16)), |
| 193 | framework::dataset::make("Beta", { 1.0f, 2.0f })), |
SiCong Li | 96209c7 | 2020-08-21 12:28:30 +0100 | [diff] [blame] | 194 | framework::dataset::make("Axis", { 0, -1, 2 }))) |
Giuseppe Rossini | 87e896a | 2018-08-24 10:24:12 +0100 | [diff] [blame] | 195 | { |
| 196 | // Validate output |
| 197 | validate(CLAccessor(_target), _reference, tolerance_f16); |
| 198 | } |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 199 | TEST_SUITE_END() |
| 200 | |
| 201 | TEST_SUITE(FP32) |
giuros01 | efbf6c8 | 2018-09-03 09:53:53 +0100 | [diff] [blame] | 202 | FIXTURE_DATA_TEST_CASE(RunSmall, CLSoftmaxLayerFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SoftmaxLayerSmallShapes(), |
| 203 | framework::dataset::make("DataType", DataType::F32)), |
| 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, 1 }))) |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 206 | { |
| 207 | // Validate output |
| 208 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 209 | } |
giuros01 | efbf6c8 | 2018-09-03 09:53:53 +0100 | [diff] [blame] | 210 | FIXTURE_DATA_TEST_CASE(RunLarge, CLSoftmaxLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::SoftmaxLayerLargeShapes(), |
| 211 | framework::dataset::make("DataType", DataType::F32)), |
| 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 |
| 216 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 217 | } |
giuros01 | efbf6c8 | 2018-09-03 09:53:53 +0100 | [diff] [blame] | 218 | FIXTURE_DATA_TEST_CASE(Run4D, CLSoftmaxLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::SoftmaxLayer4DShapes(), |
| 219 | framework::dataset::make("DataType", DataType::F32)), |
| 220 | framework::dataset::make("Beta", { 1.0f, 2.0f })), |
SiCong Li | 96209c7 | 2020-08-21 12:28:30 +0100 | [diff] [blame] | 221 | framework::dataset::make("Axis", { 0, -2, 3 }))) |
Giuseppe Rossini | 87e896a | 2018-08-24 10:24:12 +0100 | [diff] [blame] | 222 | { |
| 223 | // Validate output |
| 224 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 225 | } |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 226 | TEST_SUITE_END() |
| 227 | TEST_SUITE_END() |
| 228 | |
| 229 | template <typename T> |
Chunosov | f450caa | 2017-11-08 16:09:35 +0700 | [diff] [blame] | 230 | using CLSoftmaxLayerQuantizedFixture = SoftmaxValidationQuantizedFixture<CLTensor, CLAccessor, CLSoftmaxLayer, T>; |
| 231 | |
| 232 | TEST_SUITE(Quantized) |
| 233 | TEST_SUITE(QASYMM8) |
giuros01 | efbf6c8 | 2018-09-03 09:53:53 +0100 | [diff] [blame] | 234 | FIXTURE_DATA_TEST_CASE(RunSmall, CLSoftmaxLayerQuantizedFixture<uint8_t>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SoftmaxLayerSmallShapes(), |
Pablo Palmier | a2b89ca | 2017-10-05 15:01:34 +0100 | [diff] [blame] | 235 | framework::dataset::make("DataType", DataType::QASYMM8)), |
giuros01 | efbf6c8 | 2018-09-03 09:53:53 +0100 | [diff] [blame] | 236 | combine(framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, -10) }), |
| 237 | framework::dataset::make("Beta", { 1.0f, 2.f }))), |
SiCong Li | 96209c7 | 2020-08-21 12:28:30 +0100 | [diff] [blame] | 238 | framework::dataset::make("Axis", { 0, 1 }))) |
Chunosov | f450caa | 2017-11-08 16:09:35 +0700 | [diff] [blame] | 239 | { |
| 240 | // Validate output |
| 241 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 242 | } |
giuros01 | efbf6c8 | 2018-09-03 09:53:53 +0100 | [diff] [blame] | 243 | FIXTURE_DATA_TEST_CASE(RunLarge, CLSoftmaxLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::SoftmaxLayerLargeShapes(), |
Pablo Palmier | a2b89ca | 2017-10-05 15:01:34 +0100 | [diff] [blame] | 244 | framework::dataset::make("DataType", DataType::QASYMM8)), |
| 245 | combine(framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, -10) }), |
giuros01 | efbf6c8 | 2018-09-03 09:53:53 +0100 | [diff] [blame] | 246 | framework::dataset::make("Beta", { 1.0f, 2.0f }))), |
morgolock | 9c7fed8 | 2020-08-05 12:30:56 +0100 | [diff] [blame] | 247 | framework::dataset::make("Axis", { 0 }))) |
Chunosov | f450caa | 2017-11-08 16:09:35 +0700 | [diff] [blame] | 248 | { |
| 249 | // Validate output |
| 250 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 251 | } |
giuros01 | efbf6c8 | 2018-09-03 09:53:53 +0100 | [diff] [blame] | 252 | FIXTURE_DATA_TEST_CASE(Run4D, CLSoftmaxLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::SoftmaxLayer4DShapes(), |
Giuseppe Rossini | 87e896a | 2018-08-24 10:24:12 +0100 | [diff] [blame] | 253 | framework::dataset::make("DataType", DataType::QASYMM8)), |
giuros01 | efbf6c8 | 2018-09-03 09:53:53 +0100 | [diff] [blame] | 254 | combine(framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, -10) }), |
| 255 | framework::dataset::make("Beta", { 1.0f, 2.0f }))), |
SiCong Li | 96209c7 | 2020-08-21 12:28:30 +0100 | [diff] [blame] | 256 | framework::dataset::make("Axis", { 0, -4, 1 }))) |
Giuseppe Rossini | 87e896a | 2018-08-24 10:24:12 +0100 | [diff] [blame] | 257 | { |
| 258 | // Validate output |
| 259 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 260 | } |
| 261 | |
Sang-Hoon Park | 0779fec | 2019-11-13 17:08:12 +0000 | [diff] [blame] | 262 | TEST_SUITE_END() // QASYMM8 |
Chunosov | f450caa | 2017-11-08 16:09:35 +0700 | [diff] [blame] | 263 | |
Sang-Hoon Park | 0779fec | 2019-11-13 17:08:12 +0000 | [diff] [blame] | 264 | TEST_SUITE(QASYMM8_SIGNED) |
| 265 | |
| 266 | FIXTURE_DATA_TEST_CASE(RunSmall, CLSoftmaxLayerQuantizedFixture<int8_t>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SoftmaxLayerSmallShapes(), |
| 267 | framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)), |
| 268 | combine(framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, -10) }), |
| 269 | framework::dataset::make("Beta", { 1.0f, 2.f }))), |
SiCong Li | 96209c7 | 2020-08-21 12:28:30 +0100 | [diff] [blame] | 270 | framework::dataset::make("Axis", { 0, 1 }))) |
Sang-Hoon Park | 0779fec | 2019-11-13 17:08:12 +0000 | [diff] [blame] | 271 | { |
| 272 | // Validate output |
Sang-Hoon Park | 77d3d24 | 2020-08-10 22:50:17 +0100 | [diff] [blame] | 273 | validate(CLAccessor(_target), _reference, tolerance_qasymm8_signed); |
Sang-Hoon Park | 0779fec | 2019-11-13 17:08:12 +0000 | [diff] [blame] | 274 | } |
| 275 | |
| 276 | TEST_SUITE_END() // QASYMM8_SIGNED |
| 277 | TEST_SUITE_END() // Quantized |
| 278 | TEST_SUITE_END() // SoftmaxLayer |
| 279 | TEST_SUITE_END() // CL |
Moritz Pflanzer | f6ad98a | 2017-07-21 17:19:58 +0100 | [diff] [blame] | 280 | } // namespace validation |
| 281 | } // namespace test |
| 282 | } // namespace arm_compute |