Skip argmin/argmax with dim=None in CoreML partitioner#19247
Skip argmin/argmax with dim=None in CoreML partitioner#19247john-rocky wants to merge 2 commits intopytorch:mainfrom
Conversation
argmax/argmin with dim=None reduces over the flattened input, which CoreML does not support and which intermittently crashes the process at runtime. Reject these in the partitioner so they fall back to the portable backend; the ordinary dim=int form is still delegated. Fixes pytorch#11715.
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/19247
Note: Links to docs will display an error until the docs builds have been completed.
|
|
Hi @john-rocky! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
This PR needs a
|
Summary
argmax(x, dim=None)/argmin(x, dim=None)reduces over the flattenedtensor. CoreML does not support this reduction, and the resulting model
intermittently crashes the process at runtime (the issue reproducer
crashes 100% of the time on M1 Pro when the cell is run twice).
Detect the
dim is Nonecase inshould_override_supportso the opfalls back to the portable backend. The ordinary
dim=intform isunaffected and still gets delegated.
Fixes #11715.
Test plan
Added
test_argmax_argmin_dim_none_is_skippedcovering both branches:argmax(x, dim=None) + argmin(x, dim=None)— neither op is delegated.argmax(x, dim=1)— gets delegated as before.Authored with Claude.