scviva.utils.stats_dtype#

scviva.utils.stats_dtype(device)[source]#

Preferred floating dtype for statistical computations on device.

MPS has no float64 kernel support (a Metal hardware limitation, not a version gap), so double-precision statistics fall back to float32 there; CPU and CUDA keep float64 for numerical stability.

Parameters:
device device | str

Device (or device string, e.g. "cpu", "cuda", "mps") on which the statistics will be computed.

Return type:

dtype

Returns:

torch.float32 if device is an MPS device, otherwise torch.float64.