Browse Source

!2277 fix arithmetic simplify

Merge pull request !2277 from xianwz/r0.3
tags/v0.3.1-alpha
mindspore-ci-bot Gitee 5 years ago
parent
commit
147d0cde07
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      mindspore/ccsrc/optimizer/irpass/arithmetic_simplify.h

+ 3
- 3
mindspore/ccsrc/optimizer/irpass/arithmetic_simplify.h View File

@@ -101,24 +101,24 @@ class CheckTensorConstant {
if (fabs(data2[i] - check_value_) > FLT_EPSILON) {
return false;
}
return true;
}
return true;
} else if (tensor_type == TypeId::kNumberTypeFloat64) {
double *data2 = reinterpret_cast<double *>(tensor_ptr->data_c());
for (int i = 0; i < tensor_ptr->DataSize(); i++) {
if (fabs(data2[i] - check_value_) > DBL_EPSILON) {
return false;
}
return true;
}
return true;
} else if ((tensor_type == TypeId::kNumberTypeInt32) || (tensor_type == TypeId::kNumberTypeInt)) {
int *data2 = reinterpret_cast<int *>(tensor_ptr->data_c());
for (int i = 0; i < tensor_ptr->DataSize(); i++) {
if (data2[i] != check_value_) {
return false;
}
return true;
}
return true;
}
// Un-support Data Types
return false;


Loading…
Cancel
Save