From fce0a27c38e5733e1e78939a68f1e144be292ee6 Mon Sep 17 00:00:00 2001 From: Juhyun Lee Date: Thu, 25 Feb 2021 12:42:46 -0800 Subject: [PATCH] Move comment about some logic out of the shader code to reduce binary size. PiperOrigin-RevId: 359589291 Change-Id: I3d475705ae66a7af99cdcce7f81857cb0e6f2ad8 --- tensorflow/lite/delegates/gpu/gl/kernels/mean.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tensorflow/lite/delegates/gpu/gl/kernels/mean.cc b/tensorflow/lite/delegates/gpu/gl/kernels/mean.cc index cf88fc3cd40..b20f244efe0 100644 --- a/tensorflow/lite/delegates/gpu/gl/kernels/mean.cc +++ b/tensorflow/lite/delegates/gpu/gl/kernels/mean.cc @@ -143,13 +143,12 @@ void GenerateTrivialMean(const NodeShader::GenerationContext& ctx, {"input_data_0_h", static_cast(ctx.input_shapes[0][1])}, {"input_data_0_w", static_cast(ctx.input_shapes[0][2])}}; + // Shaders may be compiled with a precision hint mediump, which means that + // GLSL compiler may drop the size of float data type from 32 to 16 bits. + // If "sum" and "size" variables are 16bit floats, their values range + // become not enough for providing a good results accuracy. That is why + // their precision is forced to be 32bit by using highp qualifier. std::string source = R"( - // Shaders may be compiled with a precision hint mediump, which means that - // GLSL compiler may drop the size of float data type from 32 to 16 bits. - // If "sum" and "size" variables are 16bit floats, their values range - // become not enough for providing a good results accuracy. That is why - // their precision is forced to be 32bit by using highp qualifier. - highp vec4 sum = vec4(0.0); highp float size = float($input_data_0_w$ * $input_data_0_h$); for (int w = 0; w < $input_data_0_w$; w++) {