diff --git a/src/xnnpack/microparams.h b/src/xnnpack/microparams.h index 2777f3ecc80..0d697504d86 100644 --- a/src/xnnpack/microparams.h +++ b/src/xnnpack/microparams.h @@ -589,9 +589,9 @@ struct xnn_x32_packb_params { struct xnn_unary_reference_params { float x_scale; - int32_t x_zero_point; + float x_zero_point; float inv_y_scale; - int32_t y_zero_point; + float y_zero_point; union xnn_unary_params params; }; diff --git a/src/xnnpack/reference-utils.h b/src/xnnpack/reference-utils.h index 53bbb591e3b..0f962981e88 100644 --- a/src/xnnpack/reference-utils.h +++ b/src/xnnpack/reference-utils.h @@ -42,12 +42,12 @@ Result round_float_to_int(float x) { } template -float dequantize(T x, float scale, int32_t zero_point) { - return (static_cast(x) - static_cast(zero_point)) * scale; +float dequantize(T x, float scale, float zero_point) { + return (static_cast(x) - zero_point) * scale; } template -T quantize(float x, float inv_scale, int32_t zero_point) { +T quantize(float x, float inv_scale, float zero_point) { return round_float_to_int(x * inv_scale + zero_point); }