From 732bce892c0559c35bf7f3bb4408498e7dba8acd Mon Sep 17 00:00:00 2001 From: Feng Liu Date: Wed, 18 Mar 2020 22:32:39 -0700 Subject: [PATCH] Fix a floating-point check in the max pool kernel PiperOrigin-RevId: 301741177 Change-Id: I46de90f4781165733aba6e1a4c84517a2cfed24c --- tensorflow/lite/kernels/pooling.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tensorflow/lite/kernels/pooling.cc b/tensorflow/lite/kernels/pooling.cc index e871b72f4a1..63c6eb1239f 100644 --- a/tensorflow/lite/kernels/pooling.cc +++ b/tensorflow/lite/kernels/pooling.cc @@ -91,9 +91,9 @@ TfLiteStatus GenericPrepare(TfLiteContext* context, TfLiteNode* node) { if (input->type == kTfLiteUInt8 || input->type == kTfLiteInt8) { if (pool_type == kAverage || pool_type == kMax) { - TF_LITE_ENSURE_EQ(context, input->params.scale, output->params.scale); - TF_LITE_ENSURE_EQ(context, input->params.zero_point, - output->params.zero_point); + TFLITE_DCHECK_LE(std::abs(input->params.scale - output->params.scale), + 1.0e-6); + TFLITE_DCHECK_EQ(input->params.zero_point, output->params.zero_point); } if (pool_type == kL2) { // We currently don't have a quantized implementation of L2Pool