1 /** 2 * Copyright 2023 Huawei Technologies Co., Ltd 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef NNACL_KERNEL_ARITHMETIC_SELF_H_ 18 #define NNACL_KERNEL_ARITHMETIC_SELF_H_ 19 20 #include "nnacl/op_base.h" 21 #include "nnacl/tensor_c.h" 22 #include "nnacl/kernel.h" 23 24 typedef struct ArithmeticSelfFunction { 25 int primitive_type_; 26 int (*func_)(const float *input, float *output, const int element_size); 27 int (*func_bool_)(const bool *input, bool *output, const int element_size); 28 int (*func_int_)(const int *input, int *output, const int element_size); 29 int (*func_float_bool_)(const float *input, bool *output, const int element_size); 30 } ArithmeticSelfFunction; 31 32 typedef struct ArithmeticSelfF16Function { 33 int primitive_type_; 34 #ifdef ENABLE_FP16 35 int (*func_)(const float16_t *input, float16_t *output, int element_size); 36 #endif 37 } ArithmeticSelfF16Function; 38 39 typedef struct ArithmeticSelfStruct { 40 KernelBase base_; 41 int op_type_; 42 ArithmeticSelfFunction function_; 43 ArithmeticSelfF16Function f16_function_; 44 } ArithmeticSelfStruct; 45 46 KernelBase *CreateArithmeticSelf(OpParameter *param, int data_type); 47 48 #endif // NNACL_KERNEL_ARITHMETIC_SELF_H_ 49