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