Revert "Remove dead code (#111207)"
This reverts commit c2ed714f54eb6564123bb53401c4c66aeba40625.
Reverted https://github.com/pytorch/pytorch/pull/111207 on behalf of https://github.com/huydhn due to Sorry for reverting this, but it breaks lint https://hud.pytorch.org/pytorch/pytorch/commit/c2ed714f54eb6564123bb53401c4c66aeba40625 ([comment](https://github.com/pytorch/pytorch/pull/111207#issuecomment-1762126366))