# RuntimeError: MPS backend out of memory (MPS backend does not support float64, falling back to float32)

- **ID:** `pytorch/mps-scalar-type-mismatch`
- **Domain:** pytorch
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 82%

## Root Cause

MPS (Metal Performance Shaders) backend on Apple Silicon does not support float64 (double precision) tensors, causing fallback or crash when operations require double precision.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| torch>=2.0.0 | active | — | — |
| macOS>=13.0 | active | — | — |
| MPS>=1.0 | active | — | — |

## Workarounds

1. **Explicitly cast tensors to float32 before MPS operations: tensor = tensor.float()** (95% success)
   ```
   Explicitly cast tensors to float32 before MPS operations: tensor = tensor.float()
   ```
2. **Use CPU or CUDA backend for parts of model requiring float64, then move back: model.to('cpu').double()** (80% success)
   ```
   Use CPU or CUDA backend for parts of model requiring float64, then move back: model.to('cpu').double()
   ```
3. **Disable MPS fallback: torch.set_default_dtype(torch.float32) and ensure all model parameters are float32** (90% success)
   ```
   Disable MPS fallback: torch.set_default_dtype(torch.float32) and ensure all model parameters are float32
   ```

## Dead Ends

- **** — This only affects memory allocation limits, not type support; float64 operations still fail. (95% fail)
- **** — MPS hardware/driver inherently lacks float64 support; no software update can add it. (99% fail)
