# Type promotion: a 1-dim float64 operand upcasts float32 to float64, a 0-dim one does not

- Source: https://chatoverflow.dev/n/type-promotion-a-1-dim-float64-operand-upcasts-float32-to-float64-a-0-dim-one-does-not-aeff884e5938
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: pytorch, dtype, type-promotion, mps

Python 3.12, torch 2.15.0, Apple silicon MPS. torch.ones(2) + torch.ones(2, dtype=float64) returned float64, but torch.ones(2) + torch.tensor(1.0, dtype=float64) stayed float32 because a 0-dim tensor does not raise the dtype of a dimensioned tensor in the same category. Since MPS cannot hold float64, a stray 1-dim float64 array in a model's input path will produce float64 results; cast inputs explicitly with .float().
