Random sampling from a tensor constructed on MPS device, results in elements returning as torch.zeros(tensor[i].shape)
Labels: triaged, module: mps

### 🐛 Describe the bug

**Constructing a tensor on the MPS device and sampling random indices with the following code results in the random replacement of tensor[i] with the equivalent of torch.zeros(tensor.shape):**

```
import numpy as np                                                                          
import torch                                                                                       

def sample(inputs: torch.tensor, num_samples: int):                                       
    samples = np.random.choice(inputs.shape[0], num_samples) 
    inputs = inputs[samples]                                                              
    return inputs                                                                                  
                                   
# np_inputs is of type np.ndarray with shape (-1, 2, 384)                                                                    

inputs = torch.tensor(np_inputs, dtype=torch.float, device=torch.device('mps')).view(-1, 1, 2, 384)

inputs = sample(inputs, num_samples)                                                                                                     
```

Other observations:
- the distribution of zeroed elements seems to biased towards higher indices. For example with the above code, with tensor shape (N, C, H, W) and N=1,643,000 with num_samples=630,000, inputs[-1 ] has always been returned as the equivalent of torch.zeros(inputs[i].shape)  
- behavior is the same with np_inputs dtype=np.float64 and np.float32 
- behavior also occurs  when using torch.from_numpy if the devices is set to MPS
- behavior occurs even if the tensor is moved back to cpu() for sampling if it was constructed on the MPS device.

**Constructing the tensor on cpu, with the following code produced the expected behavior:**
```
import numpy as np                                                                          
import torch            
                                                                           
def sample(inputs: torch.tensor, num_samples: int):                      
    samples = np.random.choice(inputs.shape[0], num_samples)
    inputs = inputs[samples].to(torch.device('mps')                       
    return inputs                                                                                  

# np_inputs is of type np.ndarray with shape (-1, 2, 384)   
                                                                                      
inputs = torch.tensor(np_inputs, dtype=torch.float).view(-1, 1, 2, 384)

inputs = sample(inputs, num_samples)
```                                     

Constructing and sampling the tensor on cpu, and then moving the tensor to MPS results in the expected behavior, the tensor values are not zeroed and the returned tensor is composed of elements from the array of random indices.   


### Versions

Hardware: Apple 16" M1Max 64GB 4TB
OS: Monterey 12.4 (21F79)
Python: 3.9.4

[conda] numpy                     1.23.2           py39h3668e8b_0    conda-forge
[conda] pytorch                   1.13.0.dev20220922         py3.9_0    pytorch-nightly
[conda] pytorch-lightning         1.5.8              pyhd8ed1ab_0    conda-forge
[conda] pytorch3d                 0.0.1                    pypi_0    pypi
[conda] torchaudio                0.13.0.dev20220922        py39_cpu    pytorch-nightly
[conda] torchfile                 0.1.0                      py_0    conda-forge
[conda] torchgeometry             0.1.2                    pypi_0    pypi
[conda] torchmetrics              0.10.3             pyhd8ed1ab_0    conda-forge
[conda] torchvision               0.14.0.dev20220923        py39_cpu    pytorch-nightly

cc @kulinseth @albanD @malfet @DenisVieriu97 @razarmehr @abhudev