Add external callbacks into RecordFunction (#17844)
Summary:
Add a way to insert external callbacks into PT's RecordFunction
Pull Request resolved: https://github.com/pytorch/pytorch/pull/17844
Differential Revision: D14399664
Pulled By: ilia-cher
fbshipit-source-id: 76654799811fefd3ffed4abfb46ed95b492cebab