From 0b4ac76978b93ced8cc175b9ce6c26d36b10a9ab Mon Sep 17 00:00:00 2001 From: Johan Alfven Date: Mon, 12 Jun 2023 10:56:42 +0200 Subject: MLBEDS-7714: Fix assert for cascaded Resize op - Cascading was recently enabled for Resize ops. A Resize op is transformed into several ops. In this case the last op is a DepthwiseConv2DBias using NEAREST resampling mode. This resampling/ upscaling is not taken into account when calculating the ifm box size, causing the coordinates to get out of bounds. - When generating the high level command stream there is a check to see if an op is a resize op. If this is the case an upscaling factor is calculated. The fix is to change this check to instead see if the operator is using NEAREST resampling mode. If that is true, the scaling factor should be used. Change-Id: I5308a383cc3310c53004ccfe2d6fabf256478a26 Signed-off-by: Johan Alfven --- ethosu/vela/high_level_command_stream_generator.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ethosu/vela/high_level_command_stream_generator.py b/ethosu/vela/high_level_command_stream_generator.py index 961f8add..1dac1815 100644 --- a/ethosu/vela/high_level_command_stream_generator.py +++ b/ethosu/vela/high_level_command_stream_generator.py @@ -16,6 +16,7 @@ # # Description: # Generate a high-level command stream from a schedule +from .architecture_allocator import is_nearest from .high_level_command_stream import Box from .high_level_command_stream import DMA from .high_level_command_stream import NOP @@ -102,7 +103,7 @@ def generate_high_level_commands_for_sched_op(sched_op, schedule): upscaling = 1 if sched_op.op_type == Op.Conv2DBackpropInputSwitchedBias: upscaling = ofm_shape.height // ifm.shape.height - elif sched_op.op_type.is_resize_op(): + elif is_nearest(sched_op.resampling_mode): upscaling = round_up_divide(ofm_shape.height, ifm.shape.height) # Get kernel height and height dilation -- cgit v1.2.1