pytorch
d0bfd79f - Make ModuleList derive from Sequence[T] and type it appropriately (#89135)

Commit
2 years ago
Make ModuleList derive from Sequence[T] and type it appropriately (#89135) I see https://github.com/pytorch/pytorch/issues/53103 says this might be problematic, but I'm a bit confused at this point, because it looks like ModuleList does in fact already adhere to the Sequence API The big win here is that for homogenous ModuleLists, you now get typing for individual members, e.g. `ModuleList([Linear(), Linear(), Linear()])[1]` properly has type `Linear` If this looks good, I can do a followup PR to do similarly for `ModuleDict` and `Parameter[List,Dict]` Pull Request resolved: https://github.com/pytorch/pytorch/pull/89135 Approved by: https://github.com/albanD
Author
Committer
Parents
Loading