Automated sync from github.com/tensorflow/tensorflow (#2036)
BUG=automated sync from upstream
NO_CHECK_TFLITE_FILES=automated sync from upstream
diff --git a/tensorflow/lite/kernels/internal/reference/resize_bilinear.h b/tensorflow/lite/kernels/internal/reference/resize_bilinear.h
index b5edadb..bf9a88a 100644
--- a/tensorflow/lite/kernels/internal/reference/resize_bilinear.h
+++ b/tensorflow/lite/kernels/internal/reference/resize_bilinear.h
@@ -212,9 +212,14 @@
(input_y - (1 << 10) * y0) * (input_x - (1 << 10) * x0);
const int64_t output_20 =
output_20_ll + output_20_lu + output_20_rl + output_20_ru;
+#if TFLITE_SINGLE_ROUNDING
+ const int64_t round = 1 << 19;
+ const T interpolation = static_cast<T>((output_20 + round) >> 20);
+#else
const int64_t round = (output_20 > 0) ? (1 << 19) : -(1 << 19);
const T interpolation =
static_cast<T>((output_20 + round) / (1 << 20));
+#endif // TFLITE_SINGLE_ROUNDING
output_data[Offset(output_shape, b, y, x, c)] = interpolation;
}
}