Fix undefined variable errors (#72838)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/72838
Reviewed By: george-qi
Differential Revision: D34406757
Pulled By: kit1980
fbshipit-source-id: b7ab8b431eb5715fe2278ca0979542c332f1deab
(cherry picked from commit fd0cbebb16e4b8eb50103f6859c5f1f1e2a52968)