Fixed wrong return type in ModuleList getitem (#69083)
Summary:
Fixes typing error:
`Expected type ‘Iterable’ (matched generic type ‘Iterable[_T1]’), got ‘Module’ instead.
`
see: https://discuss.pytorch.org/t/modulelist-typing-error-not-an-iterable/138137/5 :
To reproduce (e.g. with mypy/pycharm):
```python
import torch.nn as nn
class Model(nn.Module):
def __init__(self):
super().__init__()
self.module_list = nn.ModuleList(
[nn.Linear(8, 8), nn.Linear(8, 8), nn.Linear(8, 8), nn.Linear(8, 8), nn.Linear(8, 1)]
)
def forward(self, batch):
for i in self.module_list[1:4]:
pass
return batch
model = Model()
out = model(torch.randn(1, 1))
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/69083
Reviewed By: davidberard98
Differential Revision: D33279114
Pulled By: jbschlosser
fbshipit-source-id: 90d74e76602163586b6ff4c49613a2694a9af37c