Yuanyuan Chen
694db5f549
Use 'is' in callable comparisons ( #166624 )
...
Just like we use `is/is not` for class comparisons, it is generally advised to use `is/is not` for comparisons against torch functions.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/166624
Approved by: https://github.com/Lucaskabela , https://github.com/Skylion007
2025-10-30 19:00:09 +00:00
Maggie Moss
84fe848503
Fix pyrefly error syntax (2/n) ( #166448 )
...
Ensrues pyrefly ignores only silence one error code.
After this, only ~40 files left to clean up .
pyrefly check
lintrunner
Pull Request resolved: https://github.com/pytorch/pytorch/pull/166448
Approved by: https://github.com/Skylion007
2025-10-29 00:36:40 +00:00
Maggie Moss
f414aa8e0d
Add pyrefly suppressions (3/n) ( #164588 )
...
Adds suppressions to pyrefly will typecheck clean: https://github.com/pytorch/pytorch/issues/163283
Test plan:
dmypy restart && python3 scripts/lintrunner.py -a
pyrefly check
step 1: uncomment lines in the pyrefly.toml file
step 2: run pyrefly check
step 3: add suppressions, clean up unused suppressions
before: https://gist.github.com/maggiemoss/bb31574ac8a59893c9cf52189e67bb2d
after:
0 errors (1,970 ignored)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/164588
Approved by: https://github.com/oulgen
2025-10-03 22:03:03 +00:00
Yiming Zhou
5211f1f908
[export] Move example inputs in move_to_device_pass ( #162301 )
...
Summary:
If i have a EP that's exported on CPU and want to AOTI compile it for CUDA. I need to use `move_to_device_pass`.
But in `torch._inductor.aoti_compile_and_package()`, it directly uses the `example_inputs` attached to the EP, so we should move the example inputs as well if applicable.
Test Plan:
buck2 run mode/dev-nosan caffe2/test:test_export -- -r test_move_device_example_inputs
Rollback Plan:
Differential Revision: D81812366
Pull Request resolved: https://github.com/pytorch/pytorch/pull/162301
Approved by: https://github.com/angelayi
2025-09-06 23:54:54 +00:00
Angela Yi
1091165826
[export] Update move_to_device_pass for to.device ( #160528 )
...
Differential Revision: D80135455
Pull Request resolved: https://github.com/pytorch/pytorch/pull/160528
Approved by: https://github.com/yushangdi
2025-08-18 15:41:48 +00:00
Angela Yi
e619c6bb90
[export] Apply move_to_device_pass to all submodules ( #159992 )
...
Previously we only applied this move_to_device_pass to the toplevel graph. However if we have HOO, this pass will not be applied on the HOO submodules. This PR modifies the pass to run on all submodules.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/159992
Approved by: https://github.com/yiming0416
2025-08-07 18:51:15 +00:00
Aaron Orenstein
db4ce78d46
PEP585: More UP006 fixes ( #146392 )
...
This should be the final PR before we can enable RUFF UP006.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/146392
Approved by: https://github.com/justinchuby , https://github.com/albanD , https://github.com/Skylion007
2025-02-20 06:18:13 +00:00
Aaron Orenstein
b6c5562c1f
PEP585 update - torch/export ( #145165 )
...
See #145101 for details.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/145165
Approved by: https://github.com/bobrenjc93
2025-01-19 20:56:55 +00:00
Gagan Jain
a6287b5c27
Fixing issue in move pass for copying Parameter ( #138855 )
...
Summary: Fixing bug for Parameter copy during move pass of exported graph.
Test Plan:
UT
runs on APS models.
Differential Revision: D64876951
Pull Request resolved: https://github.com/pytorch/pytorch/pull/138855
Approved by: https://github.com/pianpwk
Co-authored-by: Gagan Jain <gaganj@meta.com>
2024-10-25 17:57:27 +00:00
Yiming Zhou
2cfc2da527
[export] Make move_to_device_pass function public ( #134263 )
...
Summary:
This is a follow-up of https://github.com/pytorch/pytorch/pull/133660
Here we make the `move_to_device_pass()` function publich so users can call it by `from torch.export.passes import move_to_device_pass`
Test Plan: CI
Differential Revision: D61671310
Pull Request resolved: https://github.com/pytorch/pytorch/pull/134263
Approved by: https://github.com/angelayi
2024-08-23 23:18:30 +00:00