tests: Gracefully handle missing set_device for mps (#4028)
mps backend doesn't have set_device, so if mps is available on test run,
the test fails with:
AttributeError: <module 'torch.mps' from
'[...]/site-packages/torch/mps/__init__.py'> does not have the attribute
'set_device'
Co-authored-by: Marc Sun <57196510+SunMarc@users.noreply.github.com>