add trainer hook functions (#60785)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/60785
This pr adds hook functions for the trainers.
Test Plan: Imported from OSS
Reviewed By: zou3519
Differential Revision: D29697299
Pulled By: gcramer23
fbshipit-source-id: cc3b991aad0d32503fbfc5acd4fca8b404e74c0f