From e8fc214481bdbe1c80613b3f3a471c135038560e Mon Sep 17 00:00:00 2001 From: Alexander Hansson Date: Thu, 11 May 2023 16:01:39 +0000 Subject: MLBEDSW-7230: Increase support for 1x1 ResizeBilinear with half_pixel_center=True Signed-off-by: Alexander Hansson Change-Id: I0e9db22c97a9e2fbfee618262ffc43532cfcee2c --- ethosu/vela/tflite_supported_operators.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ethosu/vela/tflite_supported_operators.py b/ethosu/vela/tflite_supported_operators.py index 8e9ab12f..396fbc23 100644 --- a/ethosu/vela/tflite_supported_operators.py +++ b/ethosu/vela/tflite_supported_operators.py @@ -708,14 +708,20 @@ class TFLiteSupportedOperators: @staticmethod def constraint_resizebi_half_pixel_centers_dims(op): - """Half_pixel_centers for resize bilinear requires that OFM W and H is 2x IFM W and H""" + """Half_pixel_centers for resize bilinear requires that the width + and height of the IFM and OFM must match one of the following criteria: + IFM W and H are both 1 + OFM W and H is 2x IFM W and H""" half_pixel_centers = op.attrs.get("half_pixel_centers", False) if not half_pixel_centers: valid = True elif len(op.ifm.shape) >= 3: ifm_h, ifm_w = op.ifm.shape[-3:-1] ofm_h, ofm_w = op.ofm.shape[-3:-1] - valid = ofm_h / ifm_h == 2 and ofm_w / ifm_w == 2 + if ifm_h == 1 and ifm_w == 1: + valid = True + else: + valid = ofm_h / ifm_h == 2 and ofm_w / ifm_w == 2 else: # Unexpected IFM shape valid = False -- cgit v1.2.1