[FSDP][ez] Type optimizer correctly (#102637)
In shardedgradscaler, the optimizer doesn't have to be SGD.
Differential Revision: [D46327103](https://our.internmc.facebook.com/intern/diff/D46327103/)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/102637
Approved by: https://github.com/Skylion007, https://github.com/awgu, https://github.com/fegin