Fix use-generator lint warnings in module.py (#83700)
% pylint --disable=all --enable=R1729 torch/nn/modules/module.py
Verified in pylint 2.14.5
--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/83700
Approved by: https://github.com/kit1980, https://github.com/albanD