giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 1 | /* |
Sang-Hoon Park | 668ccdc | 2021-02-03 10:32:59 +0000 | [diff] [blame] | 2 | * Copyright (c) 2018-2021 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" |
Sheri Zhang | 1d35927 | 2021-06-10 13:56:11 +0100 | [diff] [blame] | 29 | #include "arm_compute/core/Validate.h" |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 30 | #include "tests/AssetsLibrary.h" |
| 31 | #include "tests/Globals.h" |
| 32 | #include "tests/IAccessor.h" |
| 33 | #include "tests/framework/Asserts.h" |
| 34 | #include "tests/framework/Fixture.h" |
| 35 | #include "tests/validation/Helpers.h" |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 36 | #include "tests/validation/reference/ActivationLayer.h" |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 37 | #include "tests/validation/reference/ElementwiseOperations.h" |
| 38 | |
| 39 | namespace arm_compute |
| 40 | { |
| 41 | namespace test |
| 42 | { |
| 43 | namespace validation |
| 44 | { |
| 45 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 46 | class ArithmeticOperationsGenericFixture : public framework::Fixture |
| 47 | { |
| 48 | public: |
| 49 | template <typename...> |
| 50 | void setup(ArithmeticOperation op, const TensorShape &shape0, const TensorShape &shape1, |
| 51 | DataType data_type0, DataType data_type1, DataType output_data_type, |
Sheri Zhang | 1d35927 | 2021-06-10 13:56:11 +0100 | [diff] [blame] | 52 | QuantizationInfo qinfo0, QuantizationInfo qinfo1, QuantizationInfo qinfo_out, bool in_place = false, bool use_dynamic_shape = false) |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 53 | { |
Sang-Hoon Park | 668ccdc | 2021-02-03 10:32:59 +0000 | [diff] [blame] | 54 | _op = op; |
Sheri Zhang | 1d35927 | 2021-06-10 13:56:11 +0100 | [diff] [blame] | 55 | _use_dynamic_shape = use_dynamic_shape; |
Sang-Hoon Park | 668ccdc | 2021-02-03 10:32:59 +0000 | [diff] [blame] | 56 | |
Sheri Zhang | 1d35927 | 2021-06-10 13:56:11 +0100 | [diff] [blame] | 57 | _target = compute_target(shape0, shape1, data_type0, data_type1, output_data_type, qinfo0, qinfo1, qinfo_out, in_place); |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 58 | _reference = compute_reference(shape0, shape1, data_type0, data_type1, output_data_type, qinfo0, qinfo1, qinfo_out); |
| 59 | } |
| 60 | |
| 61 | protected: |
| 62 | template <typename U> |
| 63 | void fill(U &&tensor, int i) |
| 64 | { |
Georgios Pinitas | 1813422 | 2020-09-03 21:00:23 +0100 | [diff] [blame] | 65 | if(is_data_type_float(tensor.data_type())) |
Usama Arif | 81e671e | 2019-05-13 13:33:14 +0100 | [diff] [blame] | 66 | { |
Georgios Pinitas | 1813422 | 2020-09-03 21:00:23 +0100 | [diff] [blame] | 67 | switch(_op) |
| 68 | { |
| 69 | case ArithmeticOperation::DIV: |
| 70 | library->fill_tensor_uniform_ranged(tensor, i, { std::pair<float, float>(-0.001f, 0.001f) }); |
| 71 | break; |
| 72 | case ArithmeticOperation::POWER: |
| 73 | library->fill_tensor_uniform(tensor, i, 0.0f, 5.0f); |
| 74 | break; |
| 75 | default: |
| 76 | library->fill_tensor_uniform(tensor, i); |
| 77 | } |
| 78 | } |
| 79 | else |
| 80 | { |
| 81 | library->fill_tensor_uniform(tensor, i); |
Usama Arif | 81e671e | 2019-05-13 13:33:14 +0100 | [diff] [blame] | 82 | } |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 83 | } |
| 84 | |
| 85 | TensorType compute_target(const TensorShape &shape0, const TensorShape &shape1, DataType data_type0, DataType data_type1, DataType output_data_type, |
Sheri Zhang | 1d35927 | 2021-06-10 13:56:11 +0100 | [diff] [blame] | 86 | QuantizationInfo qinfo0, QuantizationInfo qinfo1, QuantizationInfo qinfo_out, bool in_place = false) |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 87 | { |
| 88 | // Create tensors |
Sheri Zhang | 1d35927 | 2021-06-10 13:56:11 +0100 | [diff] [blame] | 89 | const TensorShape out_shape = TensorShape::broadcast_shape(shape0, shape1); |
| 90 | TensorType ref_src1 = create_tensor<TensorType>(shape0, data_type0, 1, qinfo0); |
| 91 | TensorType ref_src2 = create_tensor<TensorType>(shape1, data_type1, 1, qinfo1); |
| 92 | TensorType dst = create_tensor<TensorType>(out_shape, output_data_type, 1, qinfo_out); |
| 93 | |
| 94 | // Check whether do in-place computation and whether inputs are broadcast compatible |
| 95 | TensorType *actual_dst = &dst; |
| 96 | bool src1_can_in_place = !arm_compute::detail::have_different_dimensions(out_shape, shape0, 0) && (qinfo0 == qinfo_out); |
| 97 | bool src2_can_in_place = !arm_compute::detail::have_different_dimensions(out_shape, shape1, 0) && (qinfo1 == qinfo_out); |
| 98 | bool do_in_place = in_place && out_shape.total_size() != 0 && (src1_can_in_place || src2_can_in_place); |
| 99 | if(do_in_place) |
| 100 | { |
| 101 | if(src1_can_in_place) |
| 102 | { |
| 103 | actual_dst = &ref_src1; |
| 104 | } |
| 105 | else if(src2_can_in_place) |
| 106 | { |
| 107 | actual_dst = &ref_src2; |
| 108 | } |
| 109 | } |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 110 | |
Sang-Hoon Park | 668ccdc | 2021-02-03 10:32:59 +0000 | [diff] [blame] | 111 | // if _use_dynamic_shape is true, this fixture will test scenario for dynamic shapes. |
| 112 | // - At configure time, all input tensors are marked as dynamic using set_tensor_dynamic() |
| 113 | // - After configure, tensors are marked as static for run using set_tensor_static() |
| 114 | // - The tensors with static shape are given to run() |
| 115 | if(_use_dynamic_shape) |
| 116 | { |
| 117 | set_tensor_dynamic(ref_src1); |
| 118 | set_tensor_dynamic(ref_src2); |
| 119 | } |
| 120 | |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 121 | // Create and configure function |
| 122 | FunctionType elem_op; |
Sheri Zhang | 1d35927 | 2021-06-10 13:56:11 +0100 | [diff] [blame] | 123 | elem_op.configure(&ref_src1, &ref_src2, actual_dst); |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 124 | |
Sang-Hoon Park | 668ccdc | 2021-02-03 10:32:59 +0000 | [diff] [blame] | 125 | if(_use_dynamic_shape) |
| 126 | { |
| 127 | set_tensor_static(ref_src1); |
| 128 | set_tensor_static(ref_src2); |
| 129 | } |
| 130 | |
Michele Di Giorgio | 4fc10b3 | 2021-04-30 18:30:41 +0100 | [diff] [blame] | 131 | ARM_COMPUTE_ASSERT(ref_src1.info()->is_resizable()); |
| 132 | ARM_COMPUTE_ASSERT(ref_src2.info()->is_resizable()); |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 133 | |
| 134 | // Allocate tensors |
| 135 | ref_src1.allocator()->allocate(); |
| 136 | ref_src2.allocator()->allocate(); |
Sheri Zhang | 1d35927 | 2021-06-10 13:56:11 +0100 | [diff] [blame] | 137 | |
| 138 | // If in-place computation is not supported, still need to allocate original dst |
| 139 | if(!do_in_place) |
| 140 | { |
| 141 | ARM_COMPUTE_ASSERT(dst.info()->is_resizable()); |
| 142 | dst.allocator()->allocate(); |
| 143 | ARM_COMPUTE_ASSERT(!dst.info()->is_resizable()); |
| 144 | } |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 145 | |
Michele Di Giorgio | 4fc10b3 | 2021-04-30 18:30:41 +0100 | [diff] [blame] | 146 | ARM_COMPUTE_ASSERT(!ref_src1.info()->is_resizable()); |
| 147 | ARM_COMPUTE_ASSERT(!ref_src2.info()->is_resizable()); |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 148 | |
| 149 | // Fill tensors |
| 150 | fill(AccessorType(ref_src1), 0); |
| 151 | fill(AccessorType(ref_src2), 1); |
| 152 | |
| 153 | // Compute function |
| 154 | elem_op.run(); |
| 155 | |
Sheri Zhang | 1d35927 | 2021-06-10 13:56:11 +0100 | [diff] [blame] | 156 | return std::move(*actual_dst); |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 157 | } |
| 158 | |
| 159 | SimpleTensor<T> compute_reference(const TensorShape &shape0, const TensorShape &shape1, |
| 160 | DataType data_type0, DataType data_type1, DataType output_data_type, |
| 161 | QuantizationInfo qinfo0, QuantizationInfo qinfo1, QuantizationInfo qinfo_out) |
| 162 | { |
| 163 | // Create reference |
| 164 | SimpleTensor<T> ref_src1{ shape0, data_type0, 1, qinfo0 }; |
| 165 | SimpleTensor<T> ref_src2{ shape1, data_type1, 1, qinfo1 }; |
| 166 | SimpleTensor<T> ref_dst{ TensorShape::broadcast_shape(shape0, shape1), output_data_type, 1, qinfo_out }; |
| 167 | |
| 168 | // Fill reference |
| 169 | fill(ref_src1, 0); |
| 170 | fill(ref_src2, 1); |
| 171 | |
| 172 | return reference::arithmetic_operation<T>(_op, ref_src1, ref_src2, ref_dst); |
| 173 | } |
| 174 | |
| 175 | TensorType _target{}; |
| 176 | SimpleTensor<T> _reference{}; |
| 177 | ArithmeticOperation _op{ ArithmeticOperation::ADD }; |
Sang-Hoon Park | 668ccdc | 2021-02-03 10:32:59 +0000 | [diff] [blame] | 178 | bool _use_dynamic_shape{ false }; |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 179 | }; |
| 180 | |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 181 | // Arithmetic operation fused with activation function |
| 182 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 183 | class ArithmeticOperationsFuseActivationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 184 | { |
| 185 | public: |
| 186 | template <typename...> |
| 187 | void setup(ArithmeticOperation op, const TensorShape &shape0, const TensorShape &shape1, |
| 188 | DataType data_type0, DataType data_type1, DataType output_data_type, |
Sheri Zhang | 1d35927 | 2021-06-10 13:56:11 +0100 | [diff] [blame] | 189 | QuantizationInfo qinfo0, QuantizationInfo qinfo1, QuantizationInfo qinfo_out, ActivationLayerInfo act_info, bool in_place = false) |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 190 | { |
| 191 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(op, shape0, shape1, |
| 192 | data_type0, data_type1, output_data_type, |
Sheri Zhang | 1d35927 | 2021-06-10 13:56:11 +0100 | [diff] [blame] | 193 | qinfo0, qinfo1, qinfo_out, in_place); |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 194 | _act_info = act_info; |
| 195 | } |
| 196 | |
| 197 | protected: |
| 198 | TensorType compute_target(const TensorShape &shape0, const TensorShape &shape1, DataType data_type0, DataType data_type1, DataType output_data_type, |
| 199 | QuantizationInfo qinfo0, QuantizationInfo qinfo1, QuantizationInfo qinfo_out) |
| 200 | { |
| 201 | // Create tensors |
| 202 | TensorType ref_src1 = create_tensor<TensorType>(shape0, data_type0, 1, qinfo0); |
| 203 | TensorType ref_src2 = create_tensor<TensorType>(shape1, data_type1, 1, qinfo1); |
| 204 | TensorType dst = create_tensor<TensorType>(TensorShape::broadcast_shape(shape0, shape1), output_data_type, 1, qinfo_out); |
| 205 | |
| 206 | // Create and configure function |
| 207 | FunctionType elem_op; |
| 208 | elem_op.configure(&ref_src1, &ref_src2, &dst, _act_info); |
| 209 | |
Michele Di Giorgio | 4fc10b3 | 2021-04-30 18:30:41 +0100 | [diff] [blame] | 210 | ARM_COMPUTE_ASSERT(ref_src1.info()->is_resizable()); |
| 211 | ARM_COMPUTE_ASSERT(ref_src2.info()->is_resizable()); |
| 212 | ARM_COMPUTE_ASSERT(dst.info()->is_resizable()); |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 213 | |
| 214 | // Allocate tensors |
| 215 | ref_src1.allocator()->allocate(); |
| 216 | ref_src2.allocator()->allocate(); |
| 217 | dst.allocator()->allocate(); |
| 218 | |
Michele Di Giorgio | 4fc10b3 | 2021-04-30 18:30:41 +0100 | [diff] [blame] | 219 | ARM_COMPUTE_ASSERT(!ref_src1.info()->is_resizable()); |
| 220 | ARM_COMPUTE_ASSERT(!ref_src2.info()->is_resizable()); |
| 221 | ARM_COMPUTE_ASSERT(!dst.info()->is_resizable()); |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 222 | |
| 223 | // Fill tensors |
| 224 | fill(AccessorType(ref_src1), 0); |
| 225 | fill(AccessorType(ref_src2), 1); |
| 226 | |
| 227 | // Compute function |
| 228 | elem_op.run(); |
| 229 | |
| 230 | return dst; |
| 231 | } |
| 232 | |
| 233 | SimpleTensor<T> compute_reference(const TensorShape &shape0, const TensorShape &shape1, |
| 234 | DataType data_type0, DataType data_type1, DataType output_data_type, |
| 235 | QuantizationInfo qinfo0, QuantizationInfo qinfo1, QuantizationInfo qinfo_out) |
| 236 | { |
| 237 | auto result = ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::compute_reference(shape0, shape1, data_type0, |
| 238 | data_type1, output_data_type, qinfo0, qinfo1, qinfo_out); |
| 239 | return _act_info.enabled() ? reference::activation_layer(result, _act_info, qinfo_out) : result; |
| 240 | } |
| 241 | |
| 242 | ActivationLayerInfo _act_info{}; |
| 243 | }; |
| 244 | |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 245 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 246 | class ArithmeticDivisionBroadcastValidationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 247 | { |
| 248 | public: |
| 249 | template <typename...> |
| 250 | void setup(const TensorShape &shape0, const TensorShape &shape1, DataType data_type0, DataType data_type1, DataType output_data_type) |
| 251 | { |
| 252 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::DIV, shape0, shape1, |
| 253 | data_type0, data_type1, output_data_type, |
Sheri Zhang | 1d35927 | 2021-06-10 13:56:11 +0100 | [diff] [blame] | 254 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo(), true); |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 255 | } |
| 256 | }; |
| 257 | |
| 258 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 259 | class ArithmeticDivisionValidationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 260 | { |
| 261 | public: |
| 262 | template <typename...> |
| 263 | void setup(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type) |
| 264 | { |
| 265 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::DIV, shape, shape, |
| 266 | data_type0, data_type1, output_data_type, |
| 267 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo()); |
| 268 | } |
| 269 | }; |
| 270 | |
| 271 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
Sang-Hoon Park | 668ccdc | 2021-02-03 10:32:59 +0000 | [diff] [blame] | 272 | class ArithmeticDivisionBroadcastDynamicShapeValidationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 273 | { |
| 274 | public: |
| 275 | template <typename...> |
| 276 | void setup(const TensorShape &shape0, const TensorShape &shape1, DataType data_type0, DataType data_type1, DataType output_data_type) |
| 277 | { |
| 278 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::DIV, shape0, shape1, |
| 279 | data_type0, data_type1, output_data_type, |
Sheri Zhang | 1d35927 | 2021-06-10 13:56:11 +0100 | [diff] [blame] | 280 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo(), true, true); |
Sang-Hoon Park | 668ccdc | 2021-02-03 10:32:59 +0000 | [diff] [blame] | 281 | } |
| 282 | }; |
| 283 | |
| 284 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 285 | class ArithmeticDivisionDynamicShapeValidationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 286 | { |
| 287 | public: |
| 288 | template <typename...> |
| 289 | void setup(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type) |
| 290 | { |
| 291 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::DIV, shape, shape, |
| 292 | data_type0, data_type1, output_data_type, |
| 293 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo(), true); |
| 294 | } |
| 295 | }; |
| 296 | |
| 297 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 298 | class ArithmeticDivisionBroadcastValidationFloatFixture : public ArithmeticOperationsFuseActivationFixture<TensorType, AccessorType, FunctionType, T> |
| 299 | { |
| 300 | public: |
| 301 | template <typename...> |
| 302 | void setup(const TensorShape &shape0, const TensorShape &shape1, DataType data_type0, DataType data_type1, DataType output_data_type, ActivationLayerInfo act_info) |
| 303 | { |
| 304 | ArithmeticOperationsFuseActivationFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::DIV, shape0, shape1, |
| 305 | data_type0, data_type1, output_data_type, |
Sheri Zhang | 1d35927 | 2021-06-10 13:56:11 +0100 | [diff] [blame] | 306 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo(), act_info, true); |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 307 | } |
| 308 | }; |
| 309 | |
| 310 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 311 | class ArithmeticDivisionValidationFloatFixture : public ArithmeticOperationsFuseActivationFixture<TensorType, AccessorType, FunctionType, T> |
| 312 | { |
| 313 | public: |
| 314 | template <typename...> |
| 315 | void setup(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type, ActivationLayerInfo act_info) |
| 316 | { |
| 317 | ArithmeticOperationsFuseActivationFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::DIV, shape, shape, |
| 318 | data_type0, data_type1, output_data_type, |
| 319 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo(), act_info); |
| 320 | } |
| 321 | }; |
| 322 | |
| 323 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
Suhail Munshi | ae1c9fe | 2021-04-14 12:16:49 +0100 | [diff] [blame] | 324 | class ArithmeticDivisionValidationIntegerFixture : public ArithmeticOperationsFuseActivationFixture<TensorType, AccessorType, FunctionType, T> |
| 325 | { |
| 326 | public: |
| 327 | template <typename...> |
| 328 | void setup(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type, ActivationLayerInfo act_info) |
| 329 | { |
| 330 | ArithmeticOperationsFuseActivationFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::DIV, shape, shape, |
| 331 | data_type0, data_type1, output_data_type, |
| 332 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo(), act_info); |
| 333 | } |
| 334 | }; |
| 335 | |
| 336 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 337 | class ArithmeticDivisionValidationQuantizedFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 338 | { |
| 339 | public: |
| 340 | template <typename...> |
| 341 | void setup(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type, |
| 342 | QuantizationInfo qinfo0, QuantizationInfo qinfo1, QuantizationInfo qinfo_out) |
| 343 | |
| 344 | { |
| 345 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::DIV, shape, shape, |
| 346 | data_type0, data_type1, output_data_type, |
| 347 | qinfo0, qinfo1, qinfo_out); |
| 348 | } |
| 349 | }; |
| 350 | |
| 351 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 352 | class ElementwiseMaxBroadcastValidationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 353 | { |
| 354 | public: |
| 355 | template <typename...> |
| 356 | void setup(const TensorShape &shape0, const TensorShape &shape1, DataType data_type0, DataType data_type1, DataType output_data_type) |
| 357 | { |
| 358 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::MAX, shape0, shape1, |
| 359 | data_type0, data_type1, output_data_type, |
Sheri Zhang | 1d35927 | 2021-06-10 13:56:11 +0100 | [diff] [blame] | 360 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo(), true); |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 361 | } |
| 362 | }; |
| 363 | |
| 364 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 365 | class ElementwiseMaxValidationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 366 | { |
| 367 | public: |
| 368 | template <typename...> |
| 369 | void setup(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type) |
| 370 | { |
| 371 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::MAX, shape, shape, |
| 372 | data_type0, data_type1, output_data_type, |
| 373 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo()); |
| 374 | } |
| 375 | }; |
| 376 | |
| 377 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 378 | class ElementwiseMaxBroadcastValidationFloatFixture : public ArithmeticOperationsFuseActivationFixture<TensorType, AccessorType, FunctionType, T> |
| 379 | { |
| 380 | public: |
| 381 | template <typename...> |
| 382 | void setup(const TensorShape &shape0, const TensorShape &shape1, DataType data_type0, DataType data_type1, DataType output_data_type, ActivationLayerInfo act_info) |
| 383 | { |
| 384 | ArithmeticOperationsFuseActivationFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::MAX, shape0, shape1, |
| 385 | data_type0, data_type1, output_data_type, |
Sheri Zhang | 1d35927 | 2021-06-10 13:56:11 +0100 | [diff] [blame] | 386 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo(), act_info, true); |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 387 | } |
| 388 | }; |
| 389 | |
| 390 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 391 | class ElementwiseMaxValidationFloatFixture : public ArithmeticOperationsFuseActivationFixture<TensorType, AccessorType, FunctionType, T> |
| 392 | { |
| 393 | public: |
| 394 | template <typename...> |
| 395 | void setup(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type, ActivationLayerInfo act_info) |
| 396 | { |
| 397 | ArithmeticOperationsFuseActivationFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::MAX, shape, shape, |
| 398 | data_type0, data_type1, output_data_type, |
| 399 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo(), act_info); |
| 400 | } |
| 401 | }; |
| 402 | |
| 403 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 404 | class ElementwiseMaxValidationQuantizedFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 405 | { |
| 406 | public: |
| 407 | template <typename...> |
| 408 | void setup(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type, |
| 409 | QuantizationInfo qinfo0, QuantizationInfo qinfo1, QuantizationInfo qinfo_out) |
| 410 | |
| 411 | { |
| 412 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::MAX, shape, shape, |
| 413 | data_type0, data_type1, output_data_type, |
| 414 | qinfo0, qinfo1, qinfo_out); |
| 415 | } |
| 416 | }; |
| 417 | |
| 418 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 419 | class ElementwiseMaxQuantizedBroadcastValidationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 420 | { |
| 421 | public: |
| 422 | template <typename...> |
| 423 | void setup(const TensorShape &shape0, const TensorShape &shape1, DataType data_type0, DataType data_type1, DataType output_data_type, |
| 424 | QuantizationInfo qinfo0, QuantizationInfo qinfo1, QuantizationInfo qinfo_out) |
| 425 | |
| 426 | { |
| 427 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::MAX, shape0, shape1, |
| 428 | data_type0, data_type1, output_data_type, |
Sheri Zhang | 1d35927 | 2021-06-10 13:56:11 +0100 | [diff] [blame] | 429 | qinfo0, qinfo1, qinfo_out, true); |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 430 | } |
| 431 | }; |
| 432 | |
| 433 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 434 | class ElementwiseMinBroadcastValidationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 435 | { |
| 436 | public: |
| 437 | template <typename...> |
| 438 | void setup(const TensorShape &shape0, const TensorShape &shape1, DataType data_type0, DataType data_type1, DataType output_data_type) |
| 439 | { |
| 440 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::MIN, shape0, shape1, |
| 441 | data_type0, data_type1, output_data_type, |
Sheri Zhang | 1d35927 | 2021-06-10 13:56:11 +0100 | [diff] [blame] | 442 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo(), true); |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 443 | } |
| 444 | }; |
| 445 | |
| 446 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 447 | class ElementwiseMinValidationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 448 | { |
| 449 | public: |
| 450 | template <typename...> |
| 451 | void setup(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type) |
| 452 | { |
| 453 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::MIN, shape, shape, |
| 454 | data_type0, data_type1, output_data_type, |
| 455 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo()); |
| 456 | } |
| 457 | }; |
| 458 | |
| 459 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 460 | class ElementwiseMinBroadcastValidationFloatFixture : public ArithmeticOperationsFuseActivationFixture<TensorType, AccessorType, FunctionType, T> |
| 461 | { |
| 462 | public: |
| 463 | template <typename...> |
| 464 | void setup(const TensorShape &shape0, const TensorShape &shape1, DataType data_type0, DataType data_type1, DataType output_data_type, ActivationLayerInfo act_info) |
| 465 | { |
| 466 | ArithmeticOperationsFuseActivationFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::MIN, shape0, shape1, |
| 467 | data_type0, data_type1, output_data_type, |
Sheri Zhang | 1d35927 | 2021-06-10 13:56:11 +0100 | [diff] [blame] | 468 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo(), act_info, true); |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 469 | } |
| 470 | }; |
| 471 | |
| 472 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 473 | class ElementwiseMinValidationFloatFixture : public ArithmeticOperationsFuseActivationFixture<TensorType, AccessorType, FunctionType, T> |
| 474 | { |
| 475 | public: |
| 476 | template <typename...> |
| 477 | void setup(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type, ActivationLayerInfo act_info) |
| 478 | { |
| 479 | ArithmeticOperationsFuseActivationFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::MIN, shape, shape, |
| 480 | data_type0, data_type1, output_data_type, |
| 481 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo(), act_info); |
| 482 | } |
| 483 | }; |
| 484 | |
| 485 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 486 | class ElementwiseMinValidationQuantizedFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 487 | { |
| 488 | public: |
| 489 | template <typename...> |
| 490 | void setup(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type, |
| 491 | QuantizationInfo qinfo0, QuantizationInfo qinfo1, QuantizationInfo qinfo_out) |
| 492 | |
| 493 | { |
| 494 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::MIN, shape, shape, |
| 495 | data_type0, data_type1, output_data_type, |
| 496 | qinfo0, qinfo1, qinfo_out); |
| 497 | } |
| 498 | }; |
| 499 | |
| 500 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 501 | class ElementwiseMinQuantizedBroadcastValidationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 502 | { |
| 503 | public: |
| 504 | template <typename...> |
| 505 | void setup(const TensorShape &shape0, const TensorShape &shape1, DataType data_type0, DataType data_type1, DataType output_data_type, |
| 506 | QuantizationInfo qinfo0, QuantizationInfo qinfo1, QuantizationInfo qinfo_out) |
| 507 | |
| 508 | { |
| 509 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::MIN, shape0, shape1, |
| 510 | data_type0, data_type1, output_data_type, |
Sheri Zhang | 1d35927 | 2021-06-10 13:56:11 +0100 | [diff] [blame] | 511 | qinfo0, qinfo1, qinfo_out, true); |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 512 | } |
| 513 | }; |
| 514 | |
| 515 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 516 | class ElementwiseSquaredDiffBroadcastValidationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 517 | { |
| 518 | public: |
| 519 | template <typename...> |
| 520 | void setup(const TensorShape &shape0, const TensorShape &shape1, DataType data_type0, DataType data_type1, DataType output_data_type) |
| 521 | { |
| 522 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::SQUARED_DIFF, shape0, shape1, |
| 523 | data_type0, data_type1, output_data_type, |
Sheri Zhang | 1d35927 | 2021-06-10 13:56:11 +0100 | [diff] [blame] | 524 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo(), true); |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 525 | } |
| 526 | }; |
| 527 | |
| 528 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 529 | class ElementwiseSquaredDiffValidationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 530 | { |
| 531 | public: |
| 532 | template <typename...> |
| 533 | void setup(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type) |
| 534 | { |
| 535 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::SQUARED_DIFF, shape, shape, |
| 536 | data_type0, data_type1, output_data_type, |
| 537 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo()); |
| 538 | } |
| 539 | }; |
| 540 | |
| 541 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 542 | class ElementwiseSquaredDiffBroadcastValidationFloatFixture : public ArithmeticOperationsFuseActivationFixture<TensorType, AccessorType, FunctionType, T> |
| 543 | { |
| 544 | public: |
| 545 | template <typename...> |
| 546 | void setup(const TensorShape &shape0, const TensorShape &shape1, DataType data_type0, DataType data_type1, DataType output_data_type, ActivationLayerInfo act_info) |
| 547 | { |
| 548 | ArithmeticOperationsFuseActivationFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::SQUARED_DIFF, shape0, shape1, |
| 549 | data_type0, data_type1, output_data_type, |
Sheri Zhang | 1d35927 | 2021-06-10 13:56:11 +0100 | [diff] [blame] | 550 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo(), act_info, true); |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 551 | } |
| 552 | }; |
| 553 | |
| 554 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 555 | class ElementwiseSquaredDiffValidationFloatFixture : public ArithmeticOperationsFuseActivationFixture<TensorType, AccessorType, FunctionType, T> |
| 556 | { |
| 557 | public: |
| 558 | template <typename...> |
| 559 | void setup(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type, ActivationLayerInfo act_info) |
| 560 | { |
| 561 | ArithmeticOperationsFuseActivationFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::SQUARED_DIFF, shape, shape, |
| 562 | data_type0, data_type1, output_data_type, |
| 563 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo(), act_info); |
| 564 | } |
| 565 | }; |
| 566 | |
| 567 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 568 | class ElementwiseSquaredDiffValidationQuantizedFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 569 | { |
| 570 | public: |
| 571 | template <typename...> |
| 572 | void setup(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type, |
| 573 | QuantizationInfo qinfo0, QuantizationInfo qinfo1, QuantizationInfo qinfo_out) |
| 574 | |
| 575 | { |
| 576 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::SQUARED_DIFF, shape, shape, |
| 577 | data_type0, data_type1, output_data_type, |
| 578 | qinfo0, qinfo1, qinfo_out); |
| 579 | } |
| 580 | }; |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 581 | |
| 582 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 583 | class ElementwiseSquaredDiffQuantizedBroadcastValidationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 584 | { |
| 585 | public: |
| 586 | template <typename...> |
| 587 | void setup(const TensorShape &shape0, const TensorShape &shape1, DataType data_type0, DataType data_type1, DataType output_data_type, |
| 588 | QuantizationInfo qinfo0, QuantizationInfo qinfo1, QuantizationInfo qinfo_out) |
| 589 | |
| 590 | { |
| 591 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::SQUARED_DIFF, shape0, shape1, |
| 592 | data_type0, data_type1, output_data_type, |
Sheri Zhang | 1d35927 | 2021-06-10 13:56:11 +0100 | [diff] [blame] | 593 | qinfo0, qinfo1, qinfo_out, true); |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 594 | } |
| 595 | }; |
George Wort | a1e7e28 | 2019-01-15 11:00:29 +0000 | [diff] [blame] | 596 | |
| 597 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
giuros01 | 1e6e1b8 | 2019-05-14 16:12:53 +0100 | [diff] [blame] | 598 | class PReluLayerBroadcastValidationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 599 | { |
| 600 | public: |
| 601 | template <typename...> |
| 602 | void setup(const TensorShape &shape0, const TensorShape &shape1, DataType data_type0, DataType data_type1, DataType output_data_type) |
| 603 | { |
| 604 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::PRELU, shape0, shape1, |
| 605 | data_type0, data_type1, output_data_type, |
Sheri Zhang | 1d35927 | 2021-06-10 13:56:11 +0100 | [diff] [blame] | 606 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo(), true); |
giuros01 | 1e6e1b8 | 2019-05-14 16:12:53 +0100 | [diff] [blame] | 607 | } |
| 608 | }; |
| 609 | |
| 610 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 611 | class PReluLayerValidationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 612 | { |
| 613 | public: |
| 614 | template <typename...> |
| 615 | void setup(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type) |
| 616 | { |
| 617 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::PRELU, shape, shape, |
| 618 | data_type0, data_type1, output_data_type, |
| 619 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo()); |
| 620 | } |
| 621 | }; |
| 622 | |
| 623 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 624 | class PReluLayerValidationQuantizedFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 625 | { |
| 626 | public: |
| 627 | template <typename...> |
| 628 | void setup(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type, |
| 629 | QuantizationInfo qinfo0, QuantizationInfo qinfo1, QuantizationInfo qinfo_out) |
| 630 | |
| 631 | { |
| 632 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::PRELU, shape, shape, |
| 633 | data_type0, data_type1, output_data_type, |
| 634 | qinfo0, qinfo1, qinfo_out); |
| 635 | } |
| 636 | }; |
| 637 | |
| 638 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 639 | class PReluLayerQuantizedBroadcastValidationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 640 | { |
| 641 | public: |
| 642 | template <typename...> |
| 643 | void setup(const TensorShape &shape0, const TensorShape &shape1, DataType data_type0, DataType data_type1, DataType output_data_type, |
| 644 | QuantizationInfo qinfo0, QuantizationInfo qinfo1, QuantizationInfo qinfo_out) |
| 645 | |
| 646 | { |
| 647 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::PRELU, shape0, shape1, |
| 648 | data_type0, data_type1, output_data_type, |
Sheri Zhang | 1d35927 | 2021-06-10 13:56:11 +0100 | [diff] [blame] | 649 | qinfo0, qinfo1, qinfo_out, true); |
giuros01 | 1e6e1b8 | 2019-05-14 16:12:53 +0100 | [diff] [blame] | 650 | } |
| 651 | }; |
| 652 | |
| 653 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
Usama Arif | 81e671e | 2019-05-13 13:33:14 +0100 | [diff] [blame] | 654 | class ElementwisePowerBroadcastValidationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 655 | { |
| 656 | public: |
| 657 | template <typename...> |
| 658 | void setup(const TensorShape &shape0, const TensorShape &shape1, DataType data_type0, DataType data_type1, DataType output_data_type) |
| 659 | { |
| 660 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::POWER, shape0, shape1, |
| 661 | data_type0, data_type1, output_data_type, |
Sheri Zhang | 1d35927 | 2021-06-10 13:56:11 +0100 | [diff] [blame] | 662 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo(), true); |
Usama Arif | 81e671e | 2019-05-13 13:33:14 +0100 | [diff] [blame] | 663 | } |
| 664 | }; |
| 665 | |
| 666 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 667 | class ElementwisePowerValidationFixture : public ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 668 | { |
| 669 | public: |
| 670 | template <typename...> |
| 671 | void setup(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type) |
| 672 | { |
| 673 | ArithmeticOperationsGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::POWER, shape, shape, |
| 674 | data_type0, data_type1, output_data_type, |
| 675 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo()); |
| 676 | } |
| 677 | }; |
| 678 | |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 679 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 680 | class ElementwisePowerBroadcastValidationFloatFixture : public ArithmeticOperationsFuseActivationFixture<TensorType, AccessorType, FunctionType, T> |
| 681 | { |
| 682 | public: |
| 683 | template <typename...> |
| 684 | void setup(const TensorShape &shape0, const TensorShape &shape1, DataType data_type0, DataType data_type1, DataType output_data_type, ActivationLayerInfo act_info) |
| 685 | { |
| 686 | ArithmeticOperationsFuseActivationFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::POWER, shape0, shape1, |
| 687 | data_type0, data_type1, output_data_type, |
Sheri Zhang | 1d35927 | 2021-06-10 13:56:11 +0100 | [diff] [blame] | 688 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo(), act_info, true); |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 689 | } |
| 690 | }; |
| 691 | |
| 692 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 693 | class ElementwisePowerValidationFloatFixture : public ArithmeticOperationsFuseActivationFixture<TensorType, AccessorType, FunctionType, T> |
| 694 | { |
| 695 | public: |
| 696 | template <typename...> |
| 697 | void setup(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type, ActivationLayerInfo act_info) |
| 698 | { |
| 699 | ArithmeticOperationsFuseActivationFixture<TensorType, AccessorType, FunctionType, T>::setup(ArithmeticOperation::POWER, shape, shape, |
| 700 | data_type0, data_type1, output_data_type, |
| 701 | QuantizationInfo(), QuantizationInfo(), QuantizationInfo(), act_info); |
| 702 | } |
| 703 | }; |
| 704 | |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 705 | } // namespace validation |
| 706 | } // namespace test |
| 707 | } // namespace arm_compute |
| 708 | #endif /* ARM_COMPUTE_TEST_ARITHMETIC_OPERATIONS_FIXTURE */ |