Arm backend: use full_like in LeakyReLU decomposition#18127
Arm backend: use full_like in LeakyReLU decomposition#18127mansnils merged 2 commits intopytorch:mainfrom
Conversation
Replace `full(x.shape, slope)` with `full_like(x, slope)`. This avoids capturing export-time shape metadata and lets the created tensor inherit dtype/device from the runtime input tensor, preventing shape and device mismatches across export flows (e.g. QAT/PT2E vs already-quantized export). Because of ths LeakyRelu pass need to go before full_like_to_full conversion pass. Signed-off-by: Måns Nilsson <mans.nilsson@arm.com> Change-Id: I2cbae091c34eb3b905e402f2f122b10742b0ae1d
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/18127
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New Failure, 2 Pending, 15 Unrelated FailuresAs of commit 3ec5eb1 with merge base be0cdee ( FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
BROKEN TRUNK - The following jobs failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
There was a problem hiding this comment.
Pull request overview
Updates the Arm backend LeakyReLU decomposition to use full_like instead of full(shape, ...), reducing reliance on export-time shape/device metadata and aligning the created tensor with the runtime input tensor’s dtype/device. The TOSA pass pipeline is also reordered so the decomposition runs before the full_like→full conversion pass.
Changes:
- Switch LeakyReLU decomposition from
aten.fulltoaten.full_likeand stop reading dtype/device frommeta["val"]. - Reorder the TOSA pipeline so
DecomposeLeakyReLUPassruns beforeConvertFullLikeToFullPass. - Update the decomposition’s docstring example accordingly.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
backends/arm/_passes/decompose_leaky_relu_pass.py |
Use full_like(x, slope) during LeakyReLU decomposition to inherit properties from the runtime input. |
backends/arm/_passes/arm_pass_manager.py |
Move DecomposeLeakyReLUPass earlier so any emitted full_like can be normalized by ConvertFullLikeToFullPass. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Måns Nilsson <mans.nilsson@arm.com> Change-Id: If3947587dd806e349f4040fd0cb8b94214037145
Replace
full(x.shape, slope)withfull_like(x, slope).This avoids capturing export-time shape metadata and lets the created tensor inherit dtype/device from the runtime input tensor, preventing shape and device mismatches across export flows (e.g. QAT/PT2E vs already-quantized export).
Because of this LeakyRelu pass need to go before full_like_to_full conversion pass.
cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @Sebastian-Larsson @robell