fix backwards compatibility for #48711 and its revert (#49240)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/49240
Test Plan: Imported from OSS
Reviewed By: heitorschueroff
Differential Revision: D25500727
Pulled By: agolynski
fbshipit-source-id: 6a690f52fe671267862b159b6330d37ef08ee291