Browse Source

!13819 [MS][LITE][CPU]fix bug of floormod

From: @fuzhiye
Reviewed-by: @zhanghaibo5,@zhang_xue_tong
Signed-off-by: @zhang_xue_tong
pull/13819/MERGE
mindspore-ci-bot Gitee 5 years ago
parent
commit
e0b1afcfe5
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      mindspore/lite/nnacl/fp32/arithmetic_fp32.c

+ 3
- 1
mindspore/lite/nnacl/fp32/arithmetic_fp32.c View File

@@ -28,7 +28,9 @@ int ElementFloorMod(const float *in0, const float *in1, float *out, int size) {

int ElementFloorModInt(const int *in0, const int *in1, int *out, int size) {
for (int i = 0; i < size; i++) {
out[i] = in0[i] - (in0[i] / in1[i]) * in1[i];
NNACL_ASSERT(in1[i] != 0);
int remainder = in0[i] - (in0[i] / in1[i]) * in1[i];
out[i] = (remainder != 0) && ((in0[i] > 0) != (in1[i] > 0)) ? remainder + in1[i] : remainder;
}
return NNACL_OK;
}


Loading…
Cancel
Save