MLBEDSW-2468: Rounding 16bit scale multiplier by 0.5
Signed-off-by: Charles Xu <charles.xu@arm.com>
Change-Id: I78f475f9837a7c11f01b2693b17efe1a7c6481cc
diff --git a/ethosu/vela/register_command_stream_generator.py b/ethosu/vela/register_command_stream_generator.py
index 38ab6c1..c46016d 100644
--- a/ethosu/vela/register_command_stream_generator.py
+++ b/ethosu/vela/register_command_stream_generator.py
@@ -607,7 +607,7 @@
rescale = 0x3000 * cmd.ifm_tensor.quantization.scale_f32
if cmd.ifm_tensor.dtype == DataType.int16:
- multiplier = max(1, int(4096 * cmd.ifm_tensor.quantization.scale_f32))
+ multiplier = max(1, int(4096 * cmd.ifm_tensor.quantization.scale_f32 + 0.5))
rescale *= 3 * multiplier
rescale_bits = len(bin(round_up_to_int(rescale))) - 2 + 1