Replace list(map(...)) constructs by list comprehensions (#46461)
Summary:
As discussed in https://github.com/pytorch/pytorch/issues/46392 this makes the code more readable and possibly more performant.
It also fixes a bug detected by this where the argument order of `map` was confused: https://github.com/Flamefire/pytorch/commit/030a24906e3b5a1c8e7768e0444973d63d818fde#diff-5bb26bd3a23ee3bb540aeadcc0385df2a4e48de39f87ed9ea76b21990738fe98L1537-R1537
Fixes https://github.com/pytorch/pytorch/issues/46392
Pull Request resolved: https://github.com/pytorch/pytorch/pull/46461
Reviewed By: ailzhang
Differential Revision: D24367015
Pulled By: ezyang
fbshipit-source-id: d55a67933cc22346b00544c9671f09982ad920e7