scviva.utils.resolve_device#

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

Resolve device string, preferring CUDA, then MPS, then CPU in “auto” mode.

Parameters:
device device | str

Requested device. None or "auto" selects CUDA if available, else MPS if available, else CPU. Any other string is passed to torch.device. If the resolved device is CUDA or MPS but a test tensor cannot be allocated on it, CPU is used instead.

Return type:

device

Returns:

The resolved torch.device.