Skip to content

Commit c3d504c

Browse files
committed
Remove copied MaxPool and Pad spatial dim calculation from DW-specific PULP transformation function
1 parent 4735760 commit c3d504c

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

Deeploy/CommonExtensions/OptimizationPasses/TopologyOptimizationPasses/LoweringOptimizationPasses.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -314,21 +314,15 @@ def __init__(self, default_channels_first: bool = True):
314314
def _PULP_NCHWtoNHWC_dw_fun(graph: gs.Graph, match: Match, name: str, default_channels_first: bool = True):
315315
node = next(iter((match.nodes_map.values())))
316316

317+
# Skip non-dw nodes
317318
if node.attrs["group"] == 1:
318319
return graph
319320

320321
channels_first = node.attrs.get("channels_first", True)
321322
if (channels_first != default_channels_first):
322323
tensorOut = node.outputs[0]
323324

324-
if node.op in ["RequantizedConv", "Conv"]:
325-
spatialDims = len(node.inputs[1].shape) - 2
326-
elif node.op == "MaxPool":
327-
spatialDims = len(node.attrs["kernel_shape"])
328-
elif node.op == "Pad":
329-
spatialDims = 2 # Hack based on current status
330-
else:
331-
raise ValueError(f"Cannot determine spatialDims for node {node.name} with operator {node.op}")
325+
spatialDims = len(node.inputs[1].shape) - 2
332326

333327
# LMACAN: PULP DW doesn't transpose the input
334328

0 commit comments

Comments
 (0)