[optimizer] refactor AdamW to use functional API (#50411)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/50411
Test Plan: Imported from OSS
Reviewed By: izdeby
Differential Revision: D25932776
Pulled By: wanchaol
fbshipit-source-id: e8e1696b3390ba7909b36fd0107c58b892520432