linhaifeng
369f2d6951
[3/N] fix typo in other folders ( #166606 )
...
fix typo in other folders
#166374
#166126
_typos.toml
```bash
[files]
extend-exclude = ["tools/linter/dictionary.txt"]
[default.extend-words]
nd = "nd"
arange = "arange"
Nd = "Nd"
GLOBALs = "GLOBALs"
hte = "hte"
iy = "iy"
PN = "PN"
Dout = "Dout"
optin = "optin"
gam = "gam"
PTD = "PTD"
Sur = "Sur"
nin = "nin"
tme = "tme"
inpt = "inpt"
mis = "mis"
Raison = "Raison"
ouput = "ouput"
nto = "nto"
Onwer = "Onwer"
callibrate = "callibrate"
ser = "ser"
Metdata = "Metdata"
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/166606
Approved by: https://github.com/ezyang
2025-10-30 10:30:40 +00:00
Rob Timpe
3d4a2d8a93
[dynamo] Add __iter__ for iterable VariableTrackers ( #166349 )
...
This is in preparation for implementing iter with a polyfill
Pull Request resolved: https://github.com/pytorch/pytorch/pull/166349
Approved by: https://github.com/guilhermeleobas
2025-10-29 21:54:37 +00:00
can-gaa-hou
a479769488
[dynamo] Clean up assert in dynamo [2/N] ( #165745 )
...
Extend from #165430
* #165903(Clean up for graph break)
* ->#165745
* #165430
One main refractor from the previous PR:
* For assertions like checking `len(args)` or `len(kwargs)`, using `raise_args_mismatch` instead of `raise_type_error_exc`
I am also considering moving `raise_type_error_exc` into `utils.py` for consistency.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/165745
Approved by: https://github.com/Lucaskabela
2025-10-22 07:12:37 +00:00
can-gaa-hou
a88587348b
[dynamo] Clean up assert in dynamo [1/N] ( #165430 )
...
Fixes some part of #162852 and #164878 . These two issues have some relationship though.
* __->__ #165430
Pull Request resolved: https://github.com/pytorch/pytorch/pull/165430
Approved by: https://github.com/Lucaskabela , https://github.com/williamwen42
Co-authored-by: Lucas Kabela <lucasakabela@gmail.com>
2025-10-19 21:00:05 +00:00
Tugsbayasgalan Manlaibaatar
2395d7d7da
Relax equality check ( #165460 )
...
When an object is inherited from multiple types, the previous check would fail. So we should relax it to respect eager semantic
Differential Revision: [D84635322](https://our.internmc.facebook.com/intern/diff/D84635322 )
Pull Request resolved: https://github.com/pytorch/pytorch/pull/165460
Approved by: https://github.com/avikchaudhuri
2025-10-15 18:32:01 +00:00
Guilherme Leobas
d18e068fd6
[dict] Implement __eq__ for dict_items ( #155154 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/155154
Approved by: https://github.com/anijain2305
2025-10-14 18:56:51 +00:00
Yuanyuan Chen
70925bdf82
[1/N] Use "is" in python type comparison ( #165037 )
...
It generally recommended to use `is/is not` to compare types. Therefore this series of changes apply this suggestion in the code base, and it aims to finally enabling related linter checks.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/165037
Approved by: https://github.com/mlazos
2025-10-10 12:36:50 +00:00
Guilherme Leobas
bc7b17a36d
Realize LazyVariableTracker before raising exception ( #163350 )
...
Improves error message reported on #163321
Pull Request resolved: https://github.com/pytorch/pytorch/pull/163350
Approved by: https://github.com/Skylion007 , https://github.com/xmfan
2025-09-19 19:25:17 +00:00
Guilherme Leobas
8076a185c8
Offload set method execution to CPython when possible ( #160763 )
...
Reduces CPython `test_set.py` runtime from 63.477s to 40.298s
Pull Request resolved: https://github.com/pytorch/pytorch/pull/160763
Approved by: https://github.com/anijain2305
2025-09-03 18:26:05 +00:00
Guilherme Leobas
379ebdaf5e
[OrderedDict] Implement OrderedDict.popitem(last=...) ( #155153 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/155153
Approved by: https://github.com/anijain2305
ghstack dependencies: #160156 , #155072 , #155152
2025-08-27 15:46:40 +00:00
Guilherme Leobas
7c8f049d54
[OrderedDict] Implement OrderedDict.move_to_end(key, last=False) ( #155152 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/155152
Approved by: https://github.com/anijain2305
ghstack dependencies: #160156 , #155072
2025-08-27 15:46:40 +00:00
Guilherme Leobas
e3718c4855
[dict] Implement dict.__ior__ and fix return type in dict.__or__ ( #155072 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/155072
Approved by: https://github.com/anijain2305
ghstack dependencies: #160156
2025-08-27 15:46:40 +00:00
Tom Ritchford
774b4befa1
[BE] [dynamo] Simplify two methods in ConstDictVariable ( #159361 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/159361
Approved by: https://github.com/anijain2305
2025-08-22 11:11:30 +00:00
Michael Lazos
704594eb23
[Dynamo] make HOPs hashable ( #159910 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/159910
Approved by: https://github.com/yf225
2025-08-06 04:02:17 +00:00
Michael Lazos
20b5f694f8
[Dynamo] Make frozen dataclasses hashable ( #159529 )
...
Fixes https://github.com/pytorch/pytorch/issues/159424
Pull Request resolved: https://github.com/pytorch/pytorch/pull/159529
Approved by: https://github.com/oulgen
ghstack dependencies: #159513
2025-07-31 07:03:01 +00:00
Guilherme Leobas
b67f97c166
Correctly handle OP_CONTAINS ( #158660 )
...
CPython can fallback to `__iter__` if object doesn't implement
`__contains__`
Pull Request resolved: https://github.com/pytorch/pytorch/pull/158660
Approved by: https://github.com/zou3519
2025-07-23 22:31:51 +00:00
Guilherme Leobas
ba71eb496b
[dict] Implement dict.__eq__ and dict.__ne__ ( #154942 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/154942
Approved by: https://github.com/zou3519
ghstack dependencies: #154003 , #154793 , #154794
2025-07-10 22:50:39 +00:00
Guilherme Leobas
ba8d19ec02
[dict] Allow Dynamo to trace through explicit dict dunder method call ( #154794 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/154794
Approved by: https://github.com/mlazos
ghstack dependencies: #154003 , #154793
2025-07-10 22:50:39 +00:00
Guilherme Leobas
57d64298a0
[dict] Add dict.popitem ( #154793 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/154793
Approved by: https://github.com/mlazos , https://github.com/zou3519
ghstack dependencies: #154003
2025-07-10 22:50:39 +00:00
Guilherme Leobas
e84710d1e7
[dict] Raise TypeError in dict methods ( #154003 )
...
Raise TypeError in the following scenarios:
* #args mismatch
* arg is unhashable
Pull Request resolved: https://github.com/pytorch/pytorch/pull/154003
Approved by: https://github.com/mlazos , https://github.com/zou3519
2025-07-10 22:50:39 +00:00
Guilherme Leobas
e49acfc5c5
[list] Raise exception in invalid list method call ( #156148 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/156148
Approved by: https://github.com/zou3519
ghstack dependencies: #153969
2025-07-07 14:51:10 +00:00
Guilherme Leobas
dfcda613b6
Ensure Dynamo can trace through explicit dunder method call ( #154366 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/154366
Approved by: https://github.com/zou3519
ghstack dependencies: #153150 , #152991 , #154539 , #153553 , #154063 , #154064 , #154065 , #154066 , #154263
2025-07-04 00:46:05 +00:00
Guilherme Leobas
308b88bde9
[Dynamo] [Set] Add comparison for set subclass ( #154066 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/154066
Approved by: https://github.com/Skylion007
ghstack dependencies: #153150 , #152991 , #154539 , #153553 , #154063 , #154064 , #154065
2025-07-04 00:45:58 +00:00
Guilherme Leobas
c51da57b55
[Dynamo] [Set] Raise TypeError in set.union(...) and "__or__" ( #154065 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/154065
Approved by: https://github.com/williamwen42
ghstack dependencies: #153150 , #152991 , #154539 , #153553 , #154063 , #154064
2025-07-04 00:45:50 +00:00
Guilherme Leobas
f9544f1f0c
[Dynamo] [Set] Raise TypeError if object is unhashable ( #154064 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/154064
Approved by: https://github.com/Skylion007
ghstack dependencies: #153150 , #152991 , #154539 , #153553 , #154063
2025-07-04 00:45:42 +00:00
Guilherme Leobas
11c71053e0
[Dynamo] [Set] Implement some binop operators for dict/set/frozenset/dict_keys ( #154063 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/154063
Approved by: https://github.com/williamwen42 , https://github.com/zou3519
ghstack dependencies: #153150 , #152991 , #154539 , #153553
2025-07-04 00:45:34 +00:00
Guilherme Leobas
f651e28f80
[FrozenSet] Fixes for FrozenSet ( #152991 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/152991
Approved by: https://github.com/zou3519
ghstack dependencies: #153150
2025-07-04 00:45:11 +00:00
Guilherme Leobas
e7167dbacf
[Set] Support sets in VariableBuilder ( #153150 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/153150
Approved by: https://github.com/zou3519
2025-07-04 00:45:03 +00:00
Animesh Jain
48560eef80
[dynamo] Fix bug in dict(mapping_proxy) ( #157467 )
...
Fixes https://github.com/pytorch/pytorch/issues/157284
Pull Request resolved: https://github.com/pytorch/pytorch/pull/157467
Approved by: https://github.com/jansel , https://github.com/StrongerXi
Co-authored-by: Aaron Gokaslan <aaronGokaslan@gmail.com>
2025-07-02 22:13:02 +00:00
Xuehai Pan
1b2146fc6d
[BE][4/16] fix typos in torch/ (torch/_dynamo/) ( #156314 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/156314
Approved by: https://github.com/jingsh
ghstack dependencies: #156313
2025-06-23 02:57:19 +00:00
PyTorch MergeBot
5b427c92a8
Revert "[BE][4/16] fix typos in torch/ (torch/_dynamo/) ( #156314 )"
...
This reverts commit ead741c5fb .
Reverted https://github.com/pytorch/pytorch/pull/156314 on behalf of https://github.com/atalman due to export/test_torchbind.py::TestCompileTorchbind::test_compile_error_on_input_aliasing_contents_backend_aot_eager [GH job link](https://github.com/pytorch/pytorch/actions/runs/15804799771/job/44548489912 ) [HUD commit link](c95f7fa874 ) ([comment](https://github.com/pytorch/pytorch/pull/156313#issuecomment-2994171213 ))
2025-06-22 12:31:57 +00:00
Xuehai Pan
ead741c5fb
[BE][4/16] fix typos in torch/ (torch/_dynamo/) ( #156314 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/156314
Approved by: https://github.com/jingsh
ghstack dependencies: #156313
2025-06-22 08:43:18 +00:00
Ryan Guo
6f7694f18f
[dynamo] Reconstruct defaultdict properly ( #154931 )
...
`DefaultDictVariable` inherited `ConstDictVariable.reconstruct`, causing
dynamo to reconstruct a `DefaultDictVariable` into a dict rather than
defaultdict. This patch fixes that.
Fixes #138412 .
Pull Request resolved: https://github.com/pytorch/pytorch/pull/154931
Approved by: https://github.com/williamwen42 , https://github.com/zou3519
ghstack dependencies: #154930
2025-06-03 18:18:40 +00:00
Sidharth
c1b7dbc52a
[dynamo] unimplemented -> unimplemented_v2 in variables/dict.py ( #154040 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/154040
Approved by: https://github.com/williamwen42 , https://github.com/StrongerXi
2025-05-22 06:46:10 +00:00
Guilherme Leobas
5a0ca65555
[Set] Add correct set/frozenset __init__ behavior ( #152908 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/152908
Approved by: https://github.com/anijain2305
ghstack dependencies: #150792 , #152987 , #152988 , #152904 , #152901 , #152902 , #152903 , #152905 , #152906 , #152989 , #152907
2025-05-16 14:28:32 +00:00
Guilherme Leobas
053025494f
[Set] Raise KeyError on empty set.pop() ( #152907 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/152907
Approved by: https://github.com/anijain2305
ghstack dependencies: #150792 , #152987 , #152988 , #152904 , #152901 , #152902 , #152903 , #152905 , #152906 , #152989
2025-05-16 14:28:32 +00:00
Guilherme Leobas
5964cb5eb1
[Set] Update set.union and set.update to support *args ( #152989 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/152989
Approved by: https://github.com/anijain2305
ghstack dependencies: #150792 , #152987 , #152988 , #152904 , #152901 , #152902 , #152903 , #152905 , #152906
2025-05-16 14:28:32 +00:00
Guilherme Leobas
4759922c5e
[Set] Add set.intersection(_update) ( #152906 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/152906
Approved by: https://github.com/anijain2305
ghstack dependencies: #150792 , #152987 , #152988 , #152904 , #152901 , #152902 , #152903 , #152905
2025-05-16 14:28:32 +00:00
Guilherme Leobas
ca96d55322
[Set] Add set.difference(_update) ( #152905 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/152905
Approved by: https://github.com/anijain2305
ghstack dependencies: #150792 , #152987 , #152988 , #152904 , #152901 , #152902 , #152903
2025-05-16 14:28:32 +00:00
Guilherme Leobas
5c6830ced0
[Set] Raise KeyError if elem not contained in the set ( #152903 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/152903
Approved by: https://github.com/anijain2305
ghstack dependencies: #150792 , #152987 , #152988 , #152904 , #152901 , #152902
2025-05-16 14:28:32 +00:00
Guilherme Leobas
574f4c507a
[Set] Add set.issubset and set.issuperset ( #152902 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/152902
Approved by: https://github.com/anijain2305
ghstack dependencies: #150792 , #152987 , #152988 , #152904 , #152901
2025-05-16 14:28:32 +00:00
Guilherme Leobas
5926b7a38f
[Set] Add set.symmetric_difference(_update) ( #152901 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/152901
Approved by: https://github.com/anijain2305
ghstack dependencies: #150792 , #152987 , #152988 , #152904
2025-05-16 14:28:32 +00:00
Guilherme Leobas
fe51ce62ca
[Set] Raise TypeError if number of arguments mismatch ( #152904 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/152904
Approved by: https://github.com/anijain2305
ghstack dependencies: #150792 , #152987 , #152988
2025-05-16 14:28:32 +00:00
Guilherme Leobas
481c345f49
[Set] Raise TypeError if argument is unhashable ( #152988 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/152988
Approved by: https://github.com/anijain2305
ghstack dependencies: #150792 , #152987
2025-05-16 14:28:32 +00:00
zhxchen17
1d8cdf373b
[dynamo] Guard serialization for NAME_MATCH ( #152332 )
...
Differential Revision: [D73780430](https://our.internmc.facebook.com/intern/diff/D73780430/ )
Pull Request resolved: https://github.com/pytorch/pytorch/pull/152332
Approved by: https://github.com/jansel
ghstack dependencies: #152325 , #152326 , #152327 , #152328 , #152329 , #152330 , #152331
2025-04-29 20:16:00 +00:00
Yuanhao Ji
85ada5d6dd
[Dynamo] Allow dynamo to handle 'or' operator between two dicts ( #147305 )
...
Fixes #146538
Pull Request resolved: https://github.com/pytorch/pytorch/pull/147305
Approved by: https://github.com/anijain2305
2025-04-11 04:47:31 +00:00
Guilherme Leobas
f3b2fb6c66
Allow trace through unittest ( #146500 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/146500
Approved by: https://github.com/anijain2305
2025-04-08 14:55:17 +00:00
Yuanhao Ji
1b0a023dde
[Dynamo][Misc] Apply typing hints for codegen ( #150289 )
...
Fixes #ISSUE_NUMBER
Pull Request resolved: https://github.com/pytorch/pytorch/pull/150289
Approved by: https://github.com/Skylion007 , https://github.com/cyyever
2025-04-04 14:26:22 +00:00
Yuanhao Ji
98d06b401b
[Dynamo] Fix dict.items() return type ( #150112 )
...
Fixes #150110
Pull Request resolved: https://github.com/pytorch/pytorch/pull/150112
Approved by: https://github.com/jansel , https://github.com/zou3519
2025-04-04 04:32:13 +00:00
Xuehai Pan
3ce352e389
[BE][PYFMT] migrate PYFMT for torch._dynamo to ruff format ( #144549 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/144549
Approved by: https://github.com/jansel
2025-02-28 03:03:53 +00:00