diff options
author | Charles Xu <charles.xu@arm.com> | 2020-08-06 12:17:26 +0200 |
---|---|---|
committer | Charles Xu <charles.xu@arm.com> | 2020-08-24 14:57:01 +0200 |
commit | 87c13507b4f44edff0c819aa2bb6f9966c85c841 (patch) | |
tree | b7cb602b09ae92b74c77ad90f6f5f3675948e9b9 /ethosu/vela/register_command_stream_generator.py | |
parent | b9fc33c194036973273604d5fd7af9e814133238 (diff) | |
download | ethos-u-vela-87c13507b4f44edff0c819aa2bb6f9966c85c841.tar.gz |
MLBEDSW-2654: Convert Resizebilinear to a number of 2x2 pools
Signed-off-by: Charles Xu <charles.xu@arm.com>
Change-Id: Ida307afc33cd7963bdeb505df400732a3efcc846
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 |