From b3534e0e1b3531369a74899ccd12988cafffef82 Mon Sep 17 00:00:00 2001 From: Sebastian Larsson Date: Fri, 6 Feb 2026 08:30:03 +0100 Subject: [PATCH] Arm backend: Fix remaining docformatter issues in operator_support Change-Id: I1229120d685c91615af0e35c790edf6f038b598f Signed-off-by: Sebastian Larsson --- .lintrunner.toml | 22 ++++++------------- .../arm/operator_support/ethos_u55_support.py | 18 +++++++-------- 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/.lintrunner.toml b/.lintrunner.toml index adeaa44c693..53aefea99ed 100644 --- a/.lintrunner.toml +++ b/.lintrunner.toml @@ -506,21 +506,13 @@ command = [ [[linter]] code = 'DOCFORMATTER' -include_patterns = [ - 'backends/arm/vgf/**/*.py', - 'backends/arm/tosa/**/*.py', - 'backends/arm/ethosu/**/*.py', - 'backends/arm/operators/**/*.py', - 'backends/arm/common/**/*.py', - 'backends/arm/util/**/*.py', - 'backends/arm/runtime/**/*.py', - 'backends/arm/quantizer/**/*.py', - 'backends/arm/debug/**/*.py', - 'backends/arm/scripts/**/*.py', - 'backends/arm/operator_support/**/*.py', - 'backends/arm/*.py', -] -exclude_patterns = ['third-party/**', '**/third-party/**'] +include_patterns = ['backends/arm/**/*.py'] +exclude_patterns = [ + 'third-party/**', + '**/third-party/**', + 'backends/arm/_passes/**', + 'backends/arm/test/**', +] command = [ 'python','-m','lintrunner_adapters','run','docformatter_linter','--config=pyproject.toml','--','@{{PATHSFILE}}' ] diff --git a/backends/arm/operator_support/ethos_u55_support.py b/backends/arm/operator_support/ethos_u55_support.py index b72c5371663..d771d2668fc 100644 --- a/backends/arm/operator_support/ethos_u55_support.py +++ b/backends/arm/operator_support/ethos_u55_support.py @@ -301,10 +301,10 @@ def _check_rank_constraints( output_shape: shape_t, dtype: torch.dtype | None, ) -> bool: - """Validate high-rank reshape scenarios against U55 restrictions. - If either input or output rank of node is >4, figuring out whether - a transpose is needed or not is complex. Instead, conservatively - check that the corresponding transpose is supported on hardware. + """Validate high-rank reshape scenarios against U55 restrictions. If + either input or output rank of node is >4, figuring out whether a + transpose is needed or not is complex. Instead, conservatively check + that the corresponding transpose is supported on hardware. Args: node (fx.Node): Reshape node under inspection. @@ -364,10 +364,9 @@ def _spatial_rank(rank: int) -> int: def _transpose_requirements( self, input_shape: shape_t, output_shape: shape_t ) -> tuple[bool, bool]: - """Determine if reshaping requires input or output transposes. - For ranks >4, assume transpose is needed as we cannot determine - the spatial rank reliably which is needed to determine if a transpose - is needed. + """Determine if reshaping requires input or output transposes. For ranks + >4, assume transpose is needed as we cannot determine the spatial rank + reliably which is needed to determine if a transpose is needed. Args: input_shape (shape_t): Original tensor shape. @@ -423,7 +422,8 @@ def _check_transpose_constraints( needs_input_transpose: bool, needs_output_transpose: bool, ) -> bool: - """Apply dtype- and size-based constraints for transpose insertions + """Apply dtype- and size-based constraints for transpose insertions. + based on: - NCHW -> NHWC or NHWC -> NCHW transposes are not supported in int32. - Transposes with product of axes >65536 are not supported.