[optimizer] refactor Adam to use functional API (#44791)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/44791
Test Plan: Imported from OSS
Reviewed By: ailzhang
Differential Revision: D23935257
Pulled By: wanchaol
fbshipit-source-id: 6f6e22a9287f5515d2e4e6abd4dee2fe7e17b945