Refactor CallbackManager as a nested class of RecordFunction. (#44645)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/44645
Moved CallbackManager as a nested class of RecordFunction to allow private access to the call handles and context without exposing them publicly. It still hides the singleton instance of the CallbackManager inside record_function.cpp.
Test Plan: Unit tests.
Reviewed By: ilia-cher
Differential Revision: D23494065
fbshipit-source-id: 416d5bf6c9426e112877fbd233a6f4dff7bef455