[MPS?] .to(memory_format=contiguous_format) behaves incorrectly; differently to .contiguous()
Labels: triaged, module: mps

### 🐛 Describe the bug

found this whilst investigating training of stable-diffusion:  
https://github.com/invoke-ai/InvokeAI/issues/517#issuecomment-1257235358

after `rearrange()` is used: we have a strided tensor. if we wish to copy this safely from CPU to MPS: we should move it to contiguous memory first.

`.contiguous()` works fine.  
`.to(memory_format=contiguous_format)` doesn't seem to give us the same protection.

consequently, when we transfer our PIL image from CPU to MPS: (I think) the original, unstrided pixel data is transferred, and eventually this grayscale grid is logged:  
![inputs_gs-000500_e-000000_b-000499](https://user-images.githubusercontent.com/6141784/192158749-c6d64fc2-ecff-4a6c-941d-17bd138aa8ae.png)  

whereas if we use `.contiguous()`: all is well:  
![inputs_gs-000002_e-000000_b-000001](https://user-images.githubusercontent.com/6141784/192158774-4010d6a5-c11c-4bc0-a949-19d6d155f263.png)

```python
from torch import randn, contiguous_format
from einops import rearrange

x = randn(1, 512, 512, 3, device='cpu')
x = rearrange(x, 'b h w c -> b c h w')
y = x.to(memory_format=contiguous_format)
print(y.to('mps').cpu().allclose(y))
# False (and bad)
z = x.contiguous()
print(z.to('mps').cpu().allclose(z))
# True
```

Very similar to this issue, which was a transfer in the other direction (MPS to CPU), but lacked any attempt to transfer to contiguous memory:  
https://github.com/pytorch/pytorch/issues/79383

Affects Pytorch stable 1.12.1 and nightly 1.13.0.dev20220917.

### Versions

```
PyTorch version: 1.13.0.dev20220917
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: macOS 12.5 (arm64)
GCC version: Could not collect
Clang version: 13.0.0 (clang-1300.0.29.30)
CMake version: version 3.22.1
Libc version: N/A

Python version: 3.10.4 (main, Mar 31 2022, 03:37:37) [Clang 12.0.0 ] (64-bit runtime)
Python platform: macOS-12.5-arm64-64bit
Is CUDA available: False
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.22.4
[pip3] pytorch-lightning==1.7.5
[pip3] torch==1.13.0.dev20220917
[pip3] torch-fidelity==0.3.0
[pip3] torchdiffeq==0.2.3
[pip3] torchmetrics==0.9.3
[pip3] torchtyping==0.1.4
[pip3] torchvision==0.14.0.dev20220917
[conda] numpy                     1.22.4                   pypi_0    pypi
[conda] pytorch-lightning         1.7.5                    pypi_0    pypi
[conda] torch                     1.13.0.dev20220917          pypi_0    pypi
[conda] torch-fidelity            0.3.0                    pypi_0    pypi
[conda] torchdiffeq               0.2.3                    pypi_0    pypi
[conda] torchmetrics              0.9.3                    pypi_0    pypi
[conda] torchtyping               0.1.4                    pypi_0    pypi
[conda] torchvision               0.14.0.dev20220917          pypi_0    pypi
```

cc @kulinseth @albanD