From 9d7f98114fa6a92d882e0ce31672125fb8b3bc33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=85strand?= Date: Fri, 11 Jul 2025 14:24:34 +0200 Subject: [PATCH] Arm backend: Handle None arg for creating empty TosaArg In order to get the same number and order of arguments from fx.Node.args and the list[TosaArg] used in nodevisitor, we need to allow for empty (None) args. The empty TosaArg is represented with fields set to None and empty string for name. Change-Id: I84347ed4824a1af53ba0dab18ca37e02daecf5c4 --- backends/arm/tosa_mapping.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/backends/arm/tosa_mapping.py b/backends/arm/tosa_mapping.py index 18abe1a754e..7d662b72328 100644 --- a/backends/arm/tosa_mapping.py +++ b/backends/arm/tosa_mapping.py @@ -102,8 +102,6 @@ def __process_number(self, argument: float | int): def __init__( self, argument: Any, tosa_spec: Optional[TosaSpecification] = None ) -> None: - if argument is None: - return if tosa_spec is None: raise ValueError("tosa_spec is None") elif not isinstance(tosa_spec, TosaSpecification): @@ -125,6 +123,13 @@ def __init__( # Dtype is parsed from fake tensor return + if argument is None: + self.name = "" + self.dtype = None + self.shape = None + self.dim_order = None + return + raise RuntimeError( f"Unhandled node input argument: {argument}, of type {type(argument)}" )