Remove `optim_mt` from `test/test_optim.py` (#83549)
As per title, this updates `test_optim.py` so that `foreach` optimizers are constructed using the `foreach` keyword argument of `torch.optim` optimizers.
Also, this makes some cosmetic changes to remove `torch.autograd.Variable`, `.data` calls, and `torch._six`.
Related: https://github.com/pytorch/pytorch/pull/81705#discussion_r939440776
Pull Request resolved: https://github.com/pytorch/pytorch/pull/83549
Approved by: https://github.com/ngimel