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