diff options
Diffstat (limited to 'ethosu/vela/register_command_stream_generator.py')
-rw-r--r-- | ethosu/vela/register_command_stream_generator.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ethosu/vela/register_command_stream_generator.py b/ethosu/vela/register_command_stream_generator.py index 7b1e9a69..5a14cb4f 100644 --- a/ethosu/vela/register_command_stream_generator.py +++ b/ethosu/vela/register_command_stream_generator.py @@ -666,6 +666,11 @@ def generate_register_command_stream(nng, sg, arch, verbose=False): ifm_scale_f64 = np.double(cmd.ifm_tensor.quantization.scale_f32) ofm_scale_f64 = np.double(cmd.ofm_tensor.quantization.scale_f32) scale, shift = scaling.quantise_scale(ifm_scale_f64 / ofm_scale_f64) + elif primary_op.type == "ResizeBilinear" and "rescale" in primary_op.attrs: + rescale = primary_op.attrs["rescale"] + rescale_bits = len(bin(round_up_to_int(rescale))) - 2 + 1 + scale, shift = scaling.quantise_pooling_scale(k_height * k_width, rescale_bits) + scale = int(round_away_zero(scale * rescale)) else: # In case avg pool fused with concat or other memory operation, rescaling might be needed. # k_height == k_width == 1 is allways true in this case |