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