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