mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
[BE][Easy]: Simplify ModuleList reversed method (#151673)
Removes unnecessary list calls now that we are in Python 3.9 and KeyViews implement reversed directly. Pull Request resolved: https://github.com/pytorch/pytorch/pull/151673 Approved by: https://github.com/albanD
This commit is contained in:
parent
b7807759de
commit
cccfc146fe
|
|
@ -809,7 +809,7 @@ class ParameterDict(Module):
|
||||||
return iter(self._keys)
|
return iter(self._keys)
|
||||||
|
|
||||||
def __reversed__(self) -> Iterator[str]:
|
def __reversed__(self) -> Iterator[str]:
|
||||||
return reversed(list(self._keys))
|
return reversed(self._keys)
|
||||||
|
|
||||||
def copy(self) -> ParameterDict:
|
def copy(self) -> ParameterDict:
|
||||||
"""Return a copy of this :class:`~torch.nn.ParameterDict` instance."""
|
"""Return a copy of this :class:`~torch.nn.ParameterDict` instance."""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user