[Trainer] Move optimizer cls init to trainer_optimizer.py (#43738)
* update optimizer static method
* fix
* maybe this is a bit better ?
* update tests
* fix
* fix
* add api
* update
* let's remove for now
* Apply repo consistency fixes
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>