forked from mindspore-Ecosystem/mindspore
fix infer float compare
This commit is contained in:
parent
476484c2d9
commit
b689657f5d
|
@ -28,6 +28,8 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define EPSILON 1e-6
|
||||
|
||||
enum NNACLLshProjectionType {
|
||||
LshProjectionType_UNKNOWN = 0,
|
||||
LshProjectionType_SPARSE = 1,
|
||||
|
|
|
@ -45,13 +45,13 @@ int PriorBoxInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC
|
|||
MS_CHECK_TRUE_RET(aspect_ratios_size <= MAX_SHAPE_SIZE, NNACL_ERR);
|
||||
for (int32_t i = 0; i < aspect_ratios_size; i++) {
|
||||
float ratio = aspect_ratios[i];
|
||||
if (ratio == 0) {
|
||||
if (fabsf(ratio) < EPSILON) {
|
||||
return NNACL_ERR;
|
||||
}
|
||||
|
||||
bool exist = false;
|
||||
for (size_t j = 0; j < different_aspect_ratios_size; j++) {
|
||||
if (fabsf(ratio - different_aspect_ratios[j]) < 1e-6) {
|
||||
if (fabsf(ratio - different_aspect_ratios[j]) < EPSILON) {
|
||||
exist = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ int RangeInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **
|
|||
float start = *(float *)(inputs[0]->data_);
|
||||
float limit = *(float *)(inputs[1]->data_);
|
||||
float delta = *(float *)(inputs[2]->data_);
|
||||
if (delta == 0) {
|
||||
if (fabsf(delta) < EPSILON) {
|
||||
return NNACL_ERR;
|
||||
}
|
||||
shape_size = imax((int)(ceil((float)(limit - start) / delta)), 0);
|
||||
|
|
Loading…
Reference in New Issue