Extend empty_gpu_cache to mps (#153657)
Summary:
And replace `if: elif:` with `getattr()`
X-link: https://github.com/pytorch/pytorch/pull/153657
Approved by: https://github.com/atalman, https://github.com/wdvr, https://github.com/ZainRizvi
Reviewed By: jeanschmidt
Differential Revision: D74868779
fbshipit-source-id: 667ff18c37a228edb4ad0d508fb58b44cfba300a