aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Alfven <johan.alfven@arm.com>2023-06-12 10:56:42 +0200
committerJohan Alfven <johan.alfven@arm.com>2023-06-13 13:18:33 +0200
commit0b4ac76978b93ced8cc175b9ce6c26d36b10a9ab (patch)
treee4f5936526c5718b7b3a2aed1a2f51d2699e1a10
parent6c339854e3cb63c99f650633376cbe400dd9b23d (diff)
downloadethos-u-vela-0b4ac76978b93ced8cc175b9ce6c26d36b10a9ab.tar.gz
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 <johan.alfven@arm.com>
-rw-r--r--ethosu/vela/high_level_command_stream_generator.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/ethosu/vela/high_level_command_stream_generator.py b/ethosu/vela/high_level_command_stream_generator.py
index 961f8ad..1dac181 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