pytorch/pytorch

Set-family VariableTracker hierarchy diverges from CPython

Aberta

#192.874 aberto em 11 de ago. de 2026

 (8 comentários) (0 reação) (0 responsável)Python (28.880 forks)batch import
bot-triagedenhancementgood first issuemodule: dynamooncall: pt2triaged

Métricas do repositório

Stars
 (102.396 estrelas)
Métricas de merge de PR
 (Mesclagem média 1d 10h) (42 fundiu PRs em 30d)

Description

As part of a larger effort to align Dynamo with CPython semantics, this issue proposes fixing incorrect inheritance relationships between VariableTrackers. For instance, FrozensetVariable and SetVariable share an inheritance but one is not a subclass of the other in CPython.

The table below was created by claude with inheritances that do not match CPython.

  ┌─────────────────────────────────────────────────────────────────────────────┬───────────────────────────────────────────────────────────────────────────────┐
  │                            VT subclass relation                             │                                CPython reality                                │
  ├─────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────────────────────┤
  │ FrozensetVariable(SetVariable)                                              │ frozenset ⊄ set                                                               │
  ├─────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────────────────────┤
  │ DictKeySetVariable(SetVariable)                                             │ dict_keys ⊄ set                                                               │
  ├─────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────────────────────┤
  │ OrderedSetVariable(SetVariable)                                             │ OrderedSet ⊄ set (pure-Python, MutableSet ABC)                                │
  ├─────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────────────────────┤
  │ TupleIteratorVariable(ListIteratorVariable)                                 │ tuple_iterator ⊄ list_iterator                                                │
  ├─────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────────────────────┤
  │ DequeIteratorVariable(ListIteratorVariable)                                 │ _deque_iterator ⊄ list_iterator                                               │
  ├─────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────────────────────┤
  │ DequeReverseIteratorVariable(DequeIteratorVariable)                         │ _deque_reverse_iterator ⊄ _deque_iterator                                     │
  ├─────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────────────────────┤
  │ UserMethodVariable(UserFunctionVariable)                                    │ MethodType ⊄ FunctionType                                                     │
  ├─────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────────────────────┤
  │ WrapperUserMethodVariable(WrapperUserFunctionVariable)                      │ same                                                                          │

cc @chauhang @penguinwu @voznesenskym @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @kadeng @amjames @jataylo @azahed98

Guia do colaborador