Fix SGD memory leak when there is weight_decay (#23007)
Summary:
This fixes https://github.com/pytorch/pytorch/issues/20146. I am working on another PR that adds CPU and CUDA memory leak checking to all C++ API tests.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/23007
Differential Revision: D16358973
Pulled By: yf225
fbshipit-source-id: 5ee7ed4e61e60424031540a633e1fae09d9df171