From a07632203bc426d6d61840dae1796b5192b0dad2 Mon Sep 17 00:00:00 2001 From: Georg Zitzlsberger Date: Thu, 27 Jul 2023 22:50:15 +0200 Subject: [PATCH] Fix input rank unknown issue for resize op (similar to #1018 addressing split op) --- onnx_tf/handlers/backend/resize.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/onnx_tf/handlers/backend/resize.py b/onnx_tf/handlers/backend/resize.py index 9dcb2b33..1773c03b 100644 --- a/onnx_tf/handlers/backend/resize.py +++ b/onnx_tf/handlers/backend/resize.py @@ -64,10 +64,11 @@ def args_check(cls, node, **kwargs): cls.roi_cast_map[tf.float64] = tf.float32 if sys_config.auto_cast else None x = kwargs["tensor_dict"][node.inputs[0]] - x_shape = x.get_shape().as_list() + if x.get_shape().rank is not None: + x_shape = x.get_shape().as_list() + if len(x_shape) != 4: + exception.OP_UNSUPPORTED_EXCEPT("Resize required 4D input", "Tensorflow") x_dtype = x.dtype - if len(x_shape) != 4: - exception.OP_UNSUPPORTED_EXCEPT("Resize required 4D input", "Tensorflow") if x_dtype in cls.x_cast_map and cls.x_cast_map[x_dtype] is None: exception.DTYPE_NOT_CAST_EXCEPT( "Resize input " + node.inputs[0] + " with data type '" +