Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 7 additions & 15 deletions .lintrunner.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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}}'
]
Expand Down
18 changes: 9 additions & 9 deletions backends/arm/operator_support/ethos_u55_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
Loading