Incorrect tensor conversion to m1 MPS.
Labels: triaged, module: mps

### 🐛 Describe the bug

When converting float 64 tensors to float tensors on m1 GPU MPS unpredictable errors occur.

As discussed in thread #82707 with @philipturner and @kulinseth 

Here is the code to replicate:

```python
import numpy as np
from torch import tensor
import torch

print('numpy', np.__version__)
print('pytorch', torch.__version__)

device = torch.device("mps")

list1 = np.array([[0.0201, 0.0185, 0.0181, 0.0185, 0.0196, 0.0215, 0.0246, 0.0273, 0.0274,
         0.0252, 0.0212, 0.0179, 0.0167, 0.0164, 0.0168, 0.0188, 0.0216, 0.0237,
         0.0260, 0.0284, 0.0331, 0.0389, 0.0445, 0.0494, 0.0508, 0.0449, 0.0341,
         0.0282, 0.0299, 0.0373, 0.0462, 0.0552, 0.0621, 0.0649, 0.0649, 0.0652,
         0.0692, 0.0742, 0.0725, 0.0671, 0.0590, 0.0530, 0.0503, 0.0543, 0.0609,
         0.0615, 0.0509, 0.0394, 0.0312, 0.0279, 0.0240, 0.0248, 0.0276, 0.0312,
         0.0341, 0.0359, 0.0379, 0.0391, 0.0411, 0.0441, 0.0473, 0.0492, 0.0480,
         0.0465],
        [0.1648, 0.1620, 0.1533, 0.1466, 0.1445, 0.1462, 0.1505, 0.1573, 0.1576,
         0.1514, 0.1417, 0.1325, 0.1296, 0.1290, 0.1285, 0.1242, 0.1220, 0.1227,
         0.1244, 0.1254, 0.1266, 0.1319, 0.1366, 0.1380, 0.1338, 0.1263, 0.1234,
         0.1246, 0.1262, 0.1224, 0.1117, 0.0965, 0.0872, 0.0852, 0.0914, 0.0982,
         0.1021, 0.1045, 0.1106, 0.1168, 0.1230, 0.1246, 0.1247, 0.1238, 0.1233,
         0.1240, 0.1258, 0.1252, 0.1241, 0.1235, 0.1229, 0.1225, 0.1224, 0.1241,
         0.1342, 0.1427, 0.1462, 0.1418, 0.1322, 0.1239, 0.1132, 0.1103, 0.1116,
         0.1172]])
list2 = np.array([[0.0523, 0.0481, 0.0444, 0.0415, 0.0392, 0.0378, 0.0370, 0.0368, 0.0387,
         0.0430, 0.0493, 0.0561, 0.0612, 0.0639, 0.0645, 0.0637],
        [0.1189, 0.1251, 0.1285, 0.1287, 0.1257, 0.1213, 0.1181, 0.1152, 0.1141,
         0.1135, 0.1130, 0.1105, 0.1073, 0.1035, 0.0985, 0.0967]])
list3 = np.array([[-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.,
         -1., -1.],
        [-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.,
         -1., -1.]])

input1 = tensor(list1)
input2 = tensor(list2)
input3 = tensor(list3)

gpu_list = []

for i in range(100):
    gpu1 = input1.float().to(device=device, non_blocking=True)
    gpu2 = input2.float().to(device=device, non_blocking=True)
    gpu3 = input3.float().to(device=device, non_blocking=True)
    if len(gpu_list) > 0:
        print(gpu1 == gpu_list[0][0])
        print(gpu2 == gpu_list[0][1])
        print(gpu3 == gpu_list[0][2])
    gpu_list.append([gpu1, gpu2, gpu3])
    print(gpu1)
    print(gpu2)
    print(gpu3)
```

The beginning of output showing the problem:

```
numpy 1.22.3
pytorch 1.12.1
/opt/anaconda3/envs/multi-modal-m1/lib/python3.8/site-packages/torch/_tensor_str.py:103: UserWarning: The operator 'aten::bitwise_and.Tensor_out' is not currently supported on the MPS backend and will fall back to run on the CPU. This may have performance implications. (Triggered internally at  /Users/runner/work/_temp/anaconda/conda-bld/pytorch_1659484780698/work/aten/src/ATen/mps/MPSFallback.mm:11.)
  nonzero_finite_vals = torch.masked_select(tensor_view, torch.isfinite(tensor_view) & tensor_view.ne(0))
tensor([[ 1.1755e-38,  0.0000e+00,  2.8026e-45,  0.0000e+00,  7.0242e-38,
          0.0000e+00,  0.0000e+00,  0.0000e+00,  7.1746e-43,  2.9427e-44,
          5.1088e-03,  1.4013e-45,  0.0000e+00,  0.0000e+00,  1.6630e+13,
          1.4013e-45,  0.0000e+00,  0.0000e+00,  1.3245e-37,  3.4438e-41,
          8.7460e-36,  1.4013e-45,  7.1746e-43,  0.0000e+00,  7.6231e-43,
          0.0000e+00,  2.8026e-45,  0.0000e+00,  0.0000e+00,  0.0000e+00,
          9.6122e-41,  0.0000e+00,  2.8026e-45,  0.0000e+00,  0.0000e+00,
          0.0000e+00,  9.9773e-37,  3.4438e-41,  3.8582e-32,  1.4013e-45,
          7.1746e-43,  0.0000e+00,  3.5873e-43,  0.0000e+00,  1.4013e-45,
          0.0000e+00,  0.0000e+00,  0.0000e+00,  2.0781e-32,  1.4013e-45,
          1.0331e-22,  1.4013e-45,  0.0000e+00,  0.0000e+00,  5.1088e-03,
          1.4013e-45,  0.0000e+00,  0.0000e+00,  0.0000e+00,  0.0000e+00,
          0.0000e+00,  0.0000e+00,  0.0000e+00,  0.0000e+00],
        [ 0.0000e+00,  0.0000e+00,  3.5873e-43,  0.0000e+00,  0.0000e+00,
          0.0000e+00,  0.0000e+00,  0.0000e+00,  7.1067e-29, -2.0000e+00,
          2.7697e-28,  0.0000e+00,  1.2891e-01,  1.2900e-01,  1.2850e-01,
          1.2420e-01,  1.2200e-01,  1.2270e-01,  1.2440e-01,  1.2540e-01,
          1.2660e-01,  1.3190e-01,  1.3660e-01,  1.3800e-01,  1.3380e-01,
          1.2630e-01,  1.2340e-01,  1.2460e-01,  1.2620e-01,  1.2240e-01,
          1.1170e-01,  9.6500e-02,  8.7200e-02,  8.5200e-02,  9.1400e-02,
          9.8200e-02,  1.0210e-01,  1.0450e-01,  1.1060e-01,  1.1680e-01,
          1.2300e-01,  1.2460e-01,  1.2470e-01,  1.2380e-01,  1.2330e-01,
          1.2400e-01,  1.2580e-01,  1.2520e-01,  1.2410e-01,  1.2350e-01,
          1.2290e-01,  1.2250e-01,  1.2240e-01,  1.2410e-01,  1.3420e-01,
          1.4270e-01,  1.4620e-01,  1.4180e-01,  1.3220e-01,  1.2390e-01,
          1.1320e-01,  1.1030e-01,  1.1160e-01,  1.2880e-39]], device='mps:0')
tensor([[0.0522, 0.0481, 0.0444, 0.0415, 0.0392, 0.0378, 0.0370, 0.0368, 0.0387,
         0.0430, 0.0493, 0.0561, 0.0612, 0.0639, 0.0645, 0.0637],
        [0.1189, 0.1251, 0.1285, 0.1287, 0.1257, 0.1213, 0.1181, 0.1152, 0.1141,
         0.1135, 0.1130, 0.1105, 0.1073, 0.1035, 0.0985, 0.0967]],
       device='mps:0')
tensor([[-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.,
         -1., -1.],
        [-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.,
         -1., -1.]], device='mps:0')
tensor([[False,  True,  True,  True, False,  True,  True,  True, False,  True,
         False,  True, False,  True, False,  True,  True,  True, False,  True,
         False,  True, False,  True, False,  True, False,  True,  True,  True,
          True,  True,  True,  True,  True,  True, False,  True, False,  True,
          True,  True,  True,  True,  True,  True,  True,  True, False,  True,
         False,  True, False,  True, False,  True,  True,  True, False,  True,
          True,  True,  True,  True],
        [ True,  True,  True,  True,  True,  True,  True,  True, False, False,
         False,  True, False, False, False, False, False,  True,  True,  True,
          True,  True,  True,  True,  True,  True,  True,  True,  True,  True,
          True,  True,  True,  True,  True,  True,  True,  True,  True,  True,
          True,  True,  True,  True,  True,  True,  True,  True,  True,  True,
          True,  True,  True,  True,  True,  True,  True,  True,  True,  True,
          True,  True,  True, False]], device='mps:0')
tensor([[False, False, False, False, False,  True,  True,  True,  True,  True,
          True,  True,  True,  True,  True,  True],
        [ True,  True,  True,  True,  True,  True,  True,  True,  True,  True,
          True,  True,  True,  True,  True,  True]], device='mps:0')
tensor([[True, True, True, True, True, True, True, True, True, True, True, True,
         True, True, True, True],
        [True, True, True, True, True, True, True, True, True, True, True, True,
         True, True, True, True]], device='mps:0')
```

### Versions

Collecting environment information...
PyTorch version: 1.12.1
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.1.6 (clang-1316.0.21.2.3)
CMake version: version 3.23.3
Libc version: N/A

Python version: 3.8.13 (default, Mar 28 2022, 06:13:39)  [Clang 12.0.0 ] (64-bit runtime)
Python platform: macOS-12.5-arm64-arm-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.3
[pip3] torch==1.12.1
[pip3] torchaudio==0.12.1
[pip3] torchvision==0.13.1
[conda] numpy                     1.22.3           py38h25ab29e_0  
[conda] numpy-base                1.22.3           py38h974a1f5_0  
[conda] pytorch                   1.12.1                  py3.8_0    pytorch
[conda] torchaudio                0.12.1                 py38_cpu    pytorch
[conda] torchvision               0.13.1                 py38_cpu    pytorch


cc @kulinseth @albanD