pytorch
f5a71ec2 - [Opt Overlap] Implement as_functional_optim and create_functional_optim (#71604)

Commit
2 years ago
[Opt Overlap] Implement as_functional_optim and create_functional_optim (#71604) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/71604 Implement 2 helper functions: - as_functional_optim which takes in a torch.optim class type and arguments and creates the corresponding functional optimizer. - create_functional_optim which takes in the functional optimizer class type and constructs it. Note that as_functional_optim calls into create_functional_optim. The first will be used in future PRs as described in https://github.com/pytorch/pytorch/issues/67570 to create a functional optimizer from a traditional optimizer. The latter is used in _OptimizerHookState to create a functional optimizer. Both new helper functions are covered by unittests. ghstack-source-id: 147577170 Test Plan: CI Reviewed By: cbalioglu Differential Revision: D33688995 fbshipit-source-id: 8b2daafd1b914efa90877cc4313aa9a428546fc1 (cherry picked from commit 42fdae2991b93754501852802c292556c9addc6c)
Author
Committer
Parents
Loading