Part of #164878
Summary:
- Removes a redundant plain assert from the Adafactor foreach path.
- Drops the now-unused TYPE_CHECKING import.
- Keeps runtime behavior unchanged; the removed assert only lived under TYPE_CHECKING and `device_state_steps` is already cast to `list[Tensor]`.
Test Plan:
- `git diff --check` - passed
- `python3 -m py_compile torch/optim/_adafactor.py` - passed
- `rg -n "^\s*assert\b|TYPE_CHECKING" torch/optim/_adafactor.py` - no matches
Pull Request resolved: https://github.com/pytorch/pytorch/pull/188530
Approved by: https://github.com/janeyx99