Skip to content

Commit 5338708

Browse files
authored
Arm backend: Handle None arg for creating empty TosaArg (#12952)
### Summary 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.
1 parent b0dda93 commit 5338708

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

backends/arm/tosa_mapping.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,6 @@ def __process_number(self, argument: float | int):
102102
def __init__(
103103
self, argument: Any, tosa_spec: Optional[TosaSpecification] = None
104104
) -> None:
105-
if argument is None:
106-
return
107105
if tosa_spec is None:
108106
raise ValueError("tosa_spec is None")
109107
elif not isinstance(tosa_spec, TosaSpecification):
@@ -125,6 +123,13 @@ def __init__(
125123
# Dtype is parsed from fake tensor
126124
return
127125

126+
if argument is None:
127+
self.name = ""
128+
self.dtype = None
129+
self.shape = None
130+
self.dim_order = None
131+
return
132+
128133
raise RuntimeError(
129134
f"Unhandled node input argument: {argument}, of type {type(argument)}"
130135
)

0 commit comments

Comments
 (0)