diff --git a/mindspore/lite/nnacl/fp32/arithmetic_self_fp32.c b/mindspore/lite/nnacl/fp32/arithmetic_self_fp32.c index 72888f05b82..4a19b194e90 100644 --- a/mindspore/lite/nnacl/fp32/arithmetic_self_fp32.c +++ b/mindspore/lite/nnacl/fp32/arithmetic_self_fp32.c @@ -138,3 +138,10 @@ int ElementReciprocal(const float *input, float *output, const int element_size) } return NNACL_OK; } + +int ElementErf(const float *input, float *output, const int element_size) { + for (int i = 0; i < element_size; i++) { + output[i] = erff(input[i]); + } + return NNACL_OK; +} diff --git a/mindspore/lite/nnacl/fp32/arithmetic_self_fp32.h b/mindspore/lite/nnacl/fp32/arithmetic_self_fp32.h index a6d53f65c72..aefd434d6f9 100644 --- a/mindspore/lite/nnacl/fp32/arithmetic_self_fp32.h +++ b/mindspore/lite/nnacl/fp32/arithmetic_self_fp32.h @@ -53,6 +53,8 @@ int ElementCeil(const float *input, float *output, const int number); int ElementNegative(const float *input, float *output, const int element_size); int ElementReciprocal(const float *input, float *output, const int element_size); + +int ElementErf(const float *input, float *output, const int element_size); #ifdef __cplusplus } #endif diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/arithmetic_self_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/arithmetic_self_fp32.cc index 75dbaa06df8..73dc6eb5ae2 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/arithmetic_self_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/arithmetic_self_fp32.cc @@ -42,7 +42,8 @@ ArithmeticSelfFunc ArithmeticSelfCPUKernel::GetArithmeticSelfFun(int primitive_t {mindspore::schema::PrimitiveType_Ceil, ElementCeil}, {mindspore::schema::PrimitiveType_Round, ElementRound}, {mindspore::schema::PrimitiveType_Neg, ElementNegative}, - {mindspore::schema::PrimitiveType_Reciprocal, ElementReciprocal}}; + {mindspore::schema::PrimitiveType_Reciprocal, ElementReciprocal}, + {mindspore::schema::PrimitiveType_Erf, ElementErf}}; for (size_t i = 0; i < sizeof(type_func_table) / sizeof(TYPE_FUNC_INFO); i++) { if (type_func_table[i].primitive_type_ == primitive_type) { return type_func_table[i].func_; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/arithmetic_self_fp32.h b/mindspore/lite/src/runtime/kernel/arm/fp32/arithmetic_self_fp32.h index e88ecec4dbd..cfe0ed013ff 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/arithmetic_self_fp32.h +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/arithmetic_self_fp32.h @@ -22,6 +22,7 @@ using mindspore::schema::PrimitiveType_Abs; using mindspore::schema::PrimitiveType_Ceil; using mindspore::schema::PrimitiveType_Cos; +using mindspore::schema::PrimitiveType_Erf; using mindspore::schema::PrimitiveType_Floor; using mindspore::schema::PrimitiveType_Log; using mindspore::schema::PrimitiveType_LogicalNot;