[C++ API Parity] [Optimizers] added closure to optimizers (#34790)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/34790
Differential Revision: D20468361
Pulled By: anjali411
fbshipit-source-id: 1c6115d735b211dc2bedf002d58931cb32cf657a