giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 1 | /* |
Georgios Pinitas | 587708b | 2018-12-31 15:43:52 +0000 | [diff] [blame] | 2 | * Copyright (c) 2018-2019 ARM Limited. |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [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 | #ifndef ARM_COMPUTE_TEST_ELEMENTWISE_OPERATIONS_FIXTURE |
| 25 | #define ARM_COMPUTE_TEST_ELEMENTWISE_OPERATIONS_FIXTURE |
| 26 | |
| 27 | #include "arm_compute/core/TensorShape.h" |
| 28 | #include "arm_compute/core/Types.h" |
| 29 | #include "tests/AssetsLibrary.h" |
| 30 | #include "tests/Globals.h" |
| 31 | #include "tests/IAccessor.h" |
| 32 | #include "tests/framework/Asserts.h" |
| 33 | #include "tests/framework/Fixture.h" |
| 34 | #include "tests/validation/Helpers.h" |
| 35 | #include "tests/validation/reference/ElementwiseOperations.h" |
| 36 | |
| 37 | namespace arm_compute |
| 38 | { |
| 39 | namespace test |
| 40 | { |
| 41 | namespace validation |
| 42 | { |
| 43 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 44 | class ArithmeticOperationsGenericFixture : public framework::Fixture |
| 45 | { |
| 46 | public: |
| 47 | template <typename...> |
| 48 | void setup(ArithmeticOperation op, const TensorShape &shape0, const TensorShape &shape1, |
| 49 | DataType data_type0, DataType data_type1, DataType output_data_type, |
| 50 | QuantizationInfo qinfo0, QuantizationInfo qinfo1, QuantizationInfo qinfo_out) |
| 51 | { |
| 52 | _op = op; |
| 53 | _target = compute_target(shape0, shape1, data_type0, data_type1, output_data_type, qinfo0, qinfo1, qinfo_out); |
| 54 | _reference = compute_reference(shape0, shape1, data_type0, data_type1, output_data_type, qinfo0, qinfo1, qinfo_out); |
| 55 | } |
| 56 | |
| 57 | protected: |
| 58 | template <typename U> |
| 59 | void fill(U &&tensor, int i) |
| 60 | { |
Usama Arif | 81e671e | 2019-05-13 13:33:14 +0100 | [diff] [blame] | 61 | switch(_op) |
| 62 | { |
| 63 | case ArithmeticOperation::DIV: |
| 64 | library->fill_tensor_uniform_ranged(tensor, i, { std::pair<float, float>(-0.001f, 0.001f) }); |
| 65 | break; |
| 66 | case ArithmeticOperation::POWER: |
| 67 | library->fill_tensor_uniform(tensor, i, 0.0f, 5.0f); |
| 68 | break; |
| 69 | default: |
| 70 | library->fill_tensor_uniform(tensor, i); |
| 71 | } |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 72 | } |
| 73 | |
| 74 | TensorType compute_target(const TensorShape &shape0, const TensorShape &shape1, DataType data_type0, DataType data_type1, DataType output_data_type, |
| 75 | QuantizationInfo qinfo0, QuantizationInfo qinfo1, QuantizationInfo qinfo_out) |
| 76 | { |
| 77 | // Create tensors |
| 78 | TensorType ref_src1 = create_tensor<TensorType>(shape0, data_type0, 1, qinfo0); |
| 79 | TensorType ref_src2 = create_tensor<TensorType>(shape1, data_type1, 1, qinfo1); |
| 80 | TensorType dst = create_tensor<TensorType>(TensorShape::broadcast_shape(shape0, shape1), output_data_type, 1, qinfo_out); |
| 81 | |
| 82 | // Create and configure function |
| 83 | FunctionType elem_op; |
| 84 | elem_op.configure(&ref_src1, &ref_src2, &dst); |
| 85 | |
| 86 | ARM_COMPUTE_EXPECT(ref_src1.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 87 | ARM_COMPUTE_EXPECT(ref_src2.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 88 | ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 89 | |
| 90 | // Allocate tensors |
| 91 | ref_src1.allocator()->allocate(); |
| 92 | ref_src2.allocator()->allocate(); |
| 93 | dst.allocator()->allocate(); |
| 94 | |
| 95 | ARM_COMPUTE_EXPECT(!ref_src1.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 96 | ARM_COMPUTE_EXPECT(!ref_src2.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 97 | ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 98 | |
| 99 | // Fill tensors |
| 100 | fill(AccessorType(ref_src1), 0); |
| 101 | fill(AccessorType(ref_src2), 1); |
| 102 | |
| 103 | // Compute function |
| 104 | elem_op.run(); |
| 105 | |
| 106 | return dst; |
| 107 | } |
| 108 | |
| 109 | SimpleTensor<T> compute_reference(const TensorShape &shape0, const TensorShape &shape1, |
| 110 | DataType data_type0, DataType data_type1, DataType output_data_type, |
| 111 | QuantizationInfo qinfo0, QuantizationInfo qinfo1, QuantizationInfo qinfo_out) |
| 112 | { |
| 113 | // Create reference |
| 114 | SimpleTensor<T> ref_src1{ shape0, data_type0, 1, qinfo0 }; |
| 115 | SimpleTensor<T> ref_src2{ shape1, data_type1, 1, qinfo1 }; |
| 116 | SimpleTensor<T> ref_dst{ TensorShape::broadcast_shape(shape0, shape1), output_data_type, 1, qinfo_out }; |
| 117 | |
| 118 | // Fill reference |
| 119 | fill(ref_src1, 0); |
| 120 | fill(ref_src2, 1); |
| 121 | |
| 122 | return reference::arithmetic_operation<T>(_op, ref_src1, ref_src2, ref_dst); |
| 123 | } |
| 124 | |
| 125 | TensorType _target{}; |
| 126 | SimpleTensor<T> _reference{}; |
| 127 | ArithmeticOperation _op{ ArithmeticOperation::ADD }; |
| 128 | }; |
| 129 | |
| 130 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 131 | class ArithmeticDivisionBroadcastValidationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 132 | { |
| 133 | public: |
| 134 | template <typename...> |
| 135 | void setup(const TensorShape &shape0, const TensorShape &shape1, DataType data_type0, DataType data_type1, DataType output_data_type) |
| 136 | { |
| 137 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::DIV, shape0, shape1, |
| 138 | data_type0, data_type1, output_data_type, |
| 139 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo()); |
| 140 | } |
| 141 | }; |
| 142 | |
| 143 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 144 | class ArithmeticDivisionValidationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 145 | { |
| 146 | public: |
| 147 | template <typename...> |
| 148 | void setup(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type) |
| 149 | { |
| 150 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::DIV, shape, shape, |
| 151 | data_type0, data_type1, output_data_type, |
| 152 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo()); |
| 153 | } |
| 154 | }; |
| 155 | |
| 156 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 157 | class ArithmeticDivisionValidationQuantizedFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 158 | { |
| 159 | public: |
| 160 | template <typename...> |
| 161 | void setup(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type, |
| 162 | QuantizationInfo qinfo0, QuantizationInfo qinfo1, QuantizationInfo qinfo_out) |
| 163 | |
| 164 | { |
| 165 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::DIV, shape, shape, |
| 166 | data_type0, data_type1, output_data_type, |
| 167 | qinfo0, qinfo1, qinfo_out); |
| 168 | } |
| 169 | }; |
| 170 | |
| 171 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 172 | class ElementwiseMaxBroadcastValidationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 173 | { |
| 174 | public: |
| 175 | template <typename...> |
| 176 | void setup(const TensorShape &shape0, const TensorShape &shape1, DataType data_type0, DataType data_type1, DataType output_data_type) |
| 177 | { |
| 178 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::MAX, shape0, shape1, |
| 179 | data_type0, data_type1, output_data_type, |
| 180 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo()); |
| 181 | } |
| 182 | }; |
| 183 | |
| 184 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 185 | class ElementwiseMaxValidationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 186 | { |
| 187 | public: |
| 188 | template <typename...> |
| 189 | void setup(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type) |
| 190 | { |
| 191 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::MAX, shape, shape, |
| 192 | data_type0, data_type1, output_data_type, |
| 193 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo()); |
| 194 | } |
| 195 | }; |
| 196 | |
| 197 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 198 | class ElementwiseMaxValidationQuantizedFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 199 | { |
| 200 | public: |
| 201 | template <typename...> |
| 202 | void setup(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type, |
| 203 | QuantizationInfo qinfo0, QuantizationInfo qinfo1, QuantizationInfo qinfo_out) |
| 204 | |
| 205 | { |
| 206 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::MAX, shape, shape, |
| 207 | data_type0, data_type1, output_data_type, |
| 208 | qinfo0, qinfo1, qinfo_out); |
| 209 | } |
| 210 | }; |
| 211 | |
| 212 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 213 | class ElementwiseMaxQuantizedBroadcastValidationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 214 | { |
| 215 | public: |
| 216 | template <typename...> |
| 217 | void setup(const TensorShape &shape0, const TensorShape &shape1, DataType data_type0, DataType data_type1, DataType output_data_type, |
| 218 | QuantizationInfo qinfo0, QuantizationInfo qinfo1, QuantizationInfo qinfo_out) |
| 219 | |
| 220 | { |
| 221 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::MAX, shape0, shape1, |
| 222 | data_type0, data_type1, output_data_type, |
| 223 | qinfo0, qinfo1, qinfo_out); |
| 224 | } |
| 225 | }; |
| 226 | |
| 227 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 228 | class ElementwiseMinBroadcastValidationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 229 | { |
| 230 | public: |
| 231 | template <typename...> |
| 232 | void setup(const TensorShape &shape0, const TensorShape &shape1, DataType data_type0, DataType data_type1, DataType output_data_type) |
| 233 | { |
| 234 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::MIN, shape0, shape1, |
| 235 | data_type0, data_type1, output_data_type, |
| 236 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo()); |
| 237 | } |
| 238 | }; |
| 239 | |
| 240 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 241 | class ElementwiseMinValidationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 242 | { |
| 243 | public: |
| 244 | template <typename...> |
| 245 | void setup(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type) |
| 246 | { |
| 247 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::MIN, shape, shape, |
| 248 | data_type0, data_type1, output_data_type, |
| 249 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo()); |
| 250 | } |
| 251 | }; |
| 252 | |
| 253 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 254 | class ElementwiseMinValidationQuantizedFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 255 | { |
| 256 | public: |
| 257 | template <typename...> |
| 258 | void setup(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type, |
| 259 | QuantizationInfo qinfo0, QuantizationInfo qinfo1, QuantizationInfo qinfo_out) |
| 260 | |
| 261 | { |
| 262 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::MIN, shape, shape, |
| 263 | data_type0, data_type1, output_data_type, |
| 264 | qinfo0, qinfo1, qinfo_out); |
| 265 | } |
| 266 | }; |
| 267 | |
| 268 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 269 | class ElementwiseMinQuantizedBroadcastValidationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 270 | { |
| 271 | public: |
| 272 | template <typename...> |
| 273 | void setup(const TensorShape &shape0, const TensorShape &shape1, DataType data_type0, DataType data_type1, DataType output_data_type, |
| 274 | QuantizationInfo qinfo0, QuantizationInfo qinfo1, QuantizationInfo qinfo_out) |
| 275 | |
| 276 | { |
| 277 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::MIN, shape0, shape1, |
| 278 | data_type0, data_type1, output_data_type, |
| 279 | qinfo0, qinfo1, qinfo_out); |
| 280 | } |
| 281 | }; |
| 282 | |
| 283 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 284 | class ElementwiseSquaredDiffBroadcastValidationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 285 | { |
| 286 | public: |
| 287 | template <typename...> |
| 288 | void setup(const TensorShape &shape0, const TensorShape &shape1, DataType data_type0, DataType data_type1, DataType output_data_type) |
| 289 | { |
| 290 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::SQUARED_DIFF, shape0, shape1, |
| 291 | data_type0, data_type1, output_data_type, |
| 292 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo()); |
| 293 | } |
| 294 | }; |
| 295 | |
| 296 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 297 | class ElementwiseSquaredDiffValidationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 298 | { |
| 299 | public: |
| 300 | template <typename...> |
| 301 | void setup(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type) |
| 302 | { |
| 303 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::SQUARED_DIFF, shape, shape, |
| 304 | data_type0, data_type1, output_data_type, |
| 305 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo()); |
| 306 | } |
| 307 | }; |
| 308 | |
| 309 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 310 | class ElementwiseSquaredDiffValidationQuantizedFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 311 | { |
| 312 | public: |
| 313 | template <typename...> |
| 314 | void setup(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type, |
| 315 | QuantizationInfo qinfo0, QuantizationInfo qinfo1, QuantizationInfo qinfo_out) |
| 316 | |
| 317 | { |
| 318 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::SQUARED_DIFF, shape, shape, |
| 319 | data_type0, data_type1, output_data_type, |
| 320 | qinfo0, qinfo1, qinfo_out); |
| 321 | } |
| 322 | }; |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 323 | |
| 324 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 325 | class ElementwiseSquaredDiffQuantizedBroadcastValidationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 326 | { |
| 327 | public: |
| 328 | template <typename...> |
| 329 | void setup(const TensorShape &shape0, const TensorShape &shape1, DataType data_type0, DataType data_type1, DataType output_data_type, |
| 330 | QuantizationInfo qinfo0, QuantizationInfo qinfo1, QuantizationInfo qinfo_out) |
| 331 | |
| 332 | { |
| 333 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::SQUARED_DIFF, shape0, shape1, |
| 334 | data_type0, data_type1, output_data_type, |
| 335 | qinfo0, qinfo1, qinfo_out); |
| 336 | } |
| 337 | }; |
George Wort | a1e7e28 | 2019-01-15 11:00:29 +0000 | [diff] [blame] | 338 | |
| 339 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
giuros01 | 1e6e1b8 | 2019-05-14 16:12:53 +0100 | [diff] [blame] | 340 | class PReluLayerBroadcastValidationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 341 | { |
| 342 | public: |
| 343 | template <typename...> |
| 344 | void setup(const TensorShape &shape0, const TensorShape &shape1, DataType data_type0, DataType data_type1, DataType output_data_type) |
| 345 | { |
| 346 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::PRELU, shape0, shape1, |
| 347 | data_type0, data_type1, output_data_type, |
| 348 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo()); |
| 349 | } |
| 350 | }; |
| 351 | |
| 352 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 353 | class PReluLayerValidationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 354 | { |
| 355 | public: |
| 356 | template <typename...> |
| 357 | void setup(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type) |
| 358 | { |
| 359 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::PRELU, shape, shape, |
| 360 | data_type0, data_type1, output_data_type, |
| 361 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo()); |
| 362 | } |
| 363 | }; |
| 364 | |
| 365 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 366 | class PReluLayerValidationQuantizedFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 367 | { |
| 368 | public: |
| 369 | template <typename...> |
| 370 | void setup(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type, |
| 371 | QuantizationInfo qinfo0, QuantizationInfo qinfo1, QuantizationInfo qinfo_out) |
| 372 | |
| 373 | { |
| 374 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::PRELU, shape, shape, |
| 375 | data_type0, data_type1, output_data_type, |
| 376 | qinfo0, qinfo1, qinfo_out); |
| 377 | } |
| 378 | }; |
| 379 | |
| 380 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 381 | class PReluLayerQuantizedBroadcastValidationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 382 | { |
| 383 | public: |
| 384 | template <typename...> |
| 385 | void setup(const TensorShape &shape0, const TensorShape &shape1, DataType data_type0, DataType data_type1, DataType output_data_type, |
| 386 | QuantizationInfo qinfo0, QuantizationInfo qinfo1, QuantizationInfo qinfo_out) |
| 387 | |
| 388 | { |
| 389 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::PRELU, shape0, shape1, |
| 390 | data_type0, data_type1, output_data_type, |
| 391 | qinfo0, qinfo1, qinfo_out); |
| 392 | } |
| 393 | }; |
| 394 | |
| 395 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
George Wort | a1e7e28 | 2019-01-15 11:00:29 +0000 | [diff] [blame] | 396 | class ElementwiseDivisionBroadcastValidationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 397 | { |
| 398 | public: |
| 399 | template <typename...> |
| 400 | void setup(const TensorShape &shape0, const TensorShape &shape1, DataType data_type0, DataType data_type1, DataType output_data_type) |
| 401 | { |
| 402 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::DIV, shape0, shape1, |
| 403 | data_type0, data_type1, output_data_type, |
| 404 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo()); |
| 405 | } |
| 406 | }; |
| 407 | |
| 408 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 409 | class ElementwiseDivisionValidationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 410 | { |
| 411 | public: |
| 412 | template <typename...> |
| 413 | void setup(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type) |
| 414 | { |
| 415 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::DIV, shape, shape, |
| 416 | data_type0, data_type1, output_data_type, |
| 417 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo()); |
| 418 | } |
| 419 | }; |
| 420 | |
| 421 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 422 | class ElementwiseDivisionValidationQuantizedFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 423 | { |
| 424 | public: |
| 425 | template <typename...> |
| 426 | void setup(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type, |
| 427 | QuantizationInfo qinfo0, QuantizationInfo qinfo1, QuantizationInfo qinfo_out) |
| 428 | |
| 429 | { |
| 430 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::DIV, shape, shape, |
| 431 | data_type0, data_type1, output_data_type, |
| 432 | qinfo0, qinfo1, qinfo_out); |
| 433 | } |
| 434 | }; |
| 435 | |
| 436 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 437 | class ElementwiseDivisionQuantizedBroadcastValidationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 438 | { |
| 439 | public: |
| 440 | template <typename...> |
| 441 | void setup(const TensorShape &shape0, const TensorShape &shape1, DataType data_type0, DataType data_type1, DataType output_data_type, |
| 442 | QuantizationInfo qinfo0, QuantizationInfo qinfo1, QuantizationInfo qinfo_out) |
| 443 | |
| 444 | { |
| 445 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::DIV, shape0, shape1, |
| 446 | data_type0, data_type1, output_data_type, |
| 447 | qinfo0, qinfo1, qinfo_out); |
| 448 | } |
| 449 | }; |
| 450 | |
Usama Arif | 81e671e | 2019-05-13 13:33:14 +0100 | [diff] [blame] | 451 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 452 | class ElementwisePowerBroadcastValidationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 453 | { |
| 454 | public: |
| 455 | template <typename...> |
| 456 | void setup(const TensorShape &shape0, const TensorShape &shape1, DataType data_type0, DataType data_type1, DataType output_data_type) |
| 457 | { |
| 458 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::POWER, shape0, shape1, |
| 459 | data_type0, data_type1, output_data_type, |
| 460 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo()); |
| 461 | } |
| 462 | }; |
| 463 | |
| 464 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 465 | class ElementwisePowerValidationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 466 | { |
| 467 | public: |
| 468 | template <typename...> |
| 469 | void setup(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type) |
| 470 | { |
| 471 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::POWER, shape, shape, |
| 472 | data_type0, data_type1, output_data_type, |
| 473 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo()); |
| 474 | } |
| 475 | }; |
| 476 | |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 477 | } // namespace validation |
| 478 | } // namespace test |
| 479 | } // namespace arm_compute |
| 480 | #endif /* ARM_COMPUTE_TEST_ARITHMETIC_OPERATIONS_FIXTURE */ |