Skip to content

Commit 56ae103

Browse files
xunkai55tflite-support-robot
authored andcommitted
#fix Use <cmath> rather than <cstdlib> for abs(double).
PiperOrigin-RevId: 398370327
1 parent 38b93fb commit 56ae103

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tensorflow_lite_support/cc/task/core/category.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ limitations under the License.
1515

1616
#ifndef TENSORFLOW_LITE_SUPPORT_CC_TASK_CORE_CATEGORY_H_
1717
#define TENSORFLOW_LITE_SUPPORT_CC_TASK_CORE_CATEGORY_H_
18-
#include <cstdlib>
18+
19+
#include <cmath>
1920
#include <string>
2021

2122
namespace tflite {
@@ -32,7 +33,7 @@ struct Category {
3233
friend bool operator==(const Category& lhs, const Category& rhs) {
3334
constexpr const double kScoreTolerance = 1e-6;
3435
return lhs.class_name == rhs.class_name &&
35-
abs(lhs.score - rhs.score) <= kScoreTolerance;
36+
abs((double)(lhs.score - rhs.score)) <= kScoreTolerance;
3637
}
3738

3839
friend bool operator!=(const Category& lhs, const Category& rhs) {

0 commit comments

Comments
 (0)