[BE] Use `Literal` from `typing` (#98846)
Since PyTorch is Python-3.8+ compatible framework
Pull Request resolved: https://github.com/pytorch/pytorch/pull/98846
Approved by: https://github.com/janeyx99, https://github.com/ZainRizvi, https://github.com/Neilblaze