!28892 [MSLITE] clean fp32 bug

Merge pull request !28892 from ling/r1.6
This commit is contained in:
i-robot 2022-01-12 06:09:52 +00:00 committed by Gitee
commit c51b2cb0d6
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 7 additions and 5 deletions

View File

@ -172,7 +172,7 @@ static inline void simd_exp32(float src, float *dst) {
float decimal = src - integer * param[0]; float decimal = src - integer * param[0];
fi int_exp; fi int_exp;
int_exp.i = (integer + 127) << 23; int_exp.i = (integer + 127) << 23;
float decimal_exp = const float decimal_exp =
1.0f + decimal * (1.0f + decimal * (0.5f + decimal * (param[3] + decimal * (param[2] + decimal * param[1])))); 1.0f + decimal * (1.0f + decimal * (0.5f + decimal * (param[3] + decimal * (param[2] + decimal * param[1]))));
*dst = int_exp.f * decimal_exp; *dst = int_exp.f * decimal_exp;
} }

View File

@ -18,7 +18,8 @@
#include <string.h> #include <string.h>
#include "nnacl/errorcode.h" #include "nnacl/errorcode.h"
int DoScatterND(void *output, const void *update, int *output_unit_offsets, ScatterNDParameter *param, int task_id) { int DoScatterND(void *output, const void *update, int *output_unit_offsets, const ScatterNDParameter *param,
int task_id) {
if (param->op_parameter.thread_num_ == 0) { if (param->op_parameter.thread_num_ == 0) {
return NNACL_ERR; return NNACL_ERR;
} }

View File

@ -29,7 +29,8 @@ typedef struct ScatterNDParameter {
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
int DoScatterND(void *output, const void *update, int *output_unit_offsets, ScatterNDParameter *param, int task_id); int DoScatterND(void *output, const void *update, int *output_unit_offsets, const ScatterNDParameter *param,
int task_id);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -16,7 +16,7 @@
#include "nnacl/fp32/sparse_to_dense_fp32.h" #include "nnacl/fp32/sparse_to_dense_fp32.h"
#include "nnacl/errorcode.h" #include "nnacl/errorcode.h"
int SparseToDenseSetDefault(float *output, float default_value, SparseToDenseParameter *param, int task_id) { int SparseToDenseSetDefault(float *output, float default_value, const SparseToDenseParameter *param, int task_id) {
if (param->op_parameter_.thread_num_ == 0) { if (param->op_parameter_.thread_num_ == 0) {
return NNACL_ERR; return NNACL_ERR;
} }

View File

@ -21,7 +21,7 @@
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
int SparseToDenseSetDefault(float *output, float default_value, SparseToDenseParameter *param, int task_id); int SparseToDenseSetDefault(float *output, float default_value, const SparseToDenseParameter *param, int task_id);
int SparseToDense(int *indices_vec, const float *sparse_values, float default_value, float *output, int SparseToDense(int *indices_vec, const float *sparse_values, float default_value, float *output,
SparseToDenseParameter *param, int task_id); SparseToDenseParameter *param, int task_id);
#ifdef __cplusplus #ifdef __cplusplus