!12478 该PR实现了一个新的ERF kernel

From: @junjiecheng
Reviewed-by: @zhang_xue_tong,@jpc_chenjianping
Signed-off-by: @zhang_xue_tong
This commit is contained in:
mindspore-ci-bot 2021-02-22 09:29:21 +08:00 committed by Gitee
commit 0b258ecd26
4 changed files with 12 additions and 1 deletions

View File

@ -138,3 +138,10 @@ int ElementReciprocal(const float *input, float *output, const int element_size)
} }
return NNACL_OK; 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;
}

View File

@ -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 ElementNegative(const float *input, float *output, const int element_size);
int ElementReciprocal(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 #ifdef __cplusplus
} }
#endif #endif

View File

@ -42,7 +42,8 @@ ArithmeticSelfFunc ArithmeticSelfCPUKernel::GetArithmeticSelfFun(int primitive_t
{mindspore::schema::PrimitiveType_Ceil, ElementCeil}, {mindspore::schema::PrimitiveType_Ceil, ElementCeil},
{mindspore::schema::PrimitiveType_Round, ElementRound}, {mindspore::schema::PrimitiveType_Round, ElementRound},
{mindspore::schema::PrimitiveType_Neg, ElementNegative}, {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++) { for (size_t i = 0; i < sizeof(type_func_table) / sizeof(TYPE_FUNC_INFO); i++) {
if (type_func_table[i].primitive_type_ == primitive_type) { if (type_func_table[i].primitive_type_ == primitive_type) {
return type_func_table[i].func_; return type_func_table[i].func_;

View File

@ -22,6 +22,7 @@
using mindspore::schema::PrimitiveType_Abs; using mindspore::schema::PrimitiveType_Abs;
using mindspore::schema::PrimitiveType_Ceil; using mindspore::schema::PrimitiveType_Ceil;
using mindspore::schema::PrimitiveType_Cos; using mindspore::schema::PrimitiveType_Cos;
using mindspore::schema::PrimitiveType_Erf;
using mindspore::schema::PrimitiveType_Floor; using mindspore::schema::PrimitiveType_Floor;
using mindspore::schema::PrimitiveType_Log; using mindspore::schema::PrimitiveType_Log;
using mindspore::schema::PrimitiveType_LogicalNot; using mindspore::schema::PrimitiveType_LogicalNot;