Fix record_function (#37364)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/37364
Test Plan: Imported from OSS
Reviewed By: ilia-cher
Differential Revision: D21265347
Pulled By: jamesr66a
fbshipit-source-id: f2fe2f6879ea220501fc518977cdb6a6d3529f87