From 9c70861343651f8fde8c5db28120ab60bd36f0e8 Mon Sep 17 00:00:00 2001 From: Xian Weizhao Date: Thu, 18 Jun 2020 12:13:29 +0800 Subject: [PATCH] fix arithmetic simplify --- mindspore/ccsrc/optimizer/irpass/arithmetic_simplify.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mindspore/ccsrc/optimizer/irpass/arithmetic_simplify.h b/mindspore/ccsrc/optimizer/irpass/arithmetic_simplify.h index 8fc8f6fc1..b51d7c704 100644 --- a/mindspore/ccsrc/optimizer/irpass/arithmetic_simplify.h +++ b/mindspore/ccsrc/optimizer/irpass/arithmetic_simplify.h @@ -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(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(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; -- GitLab