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.
Noneor"auto"selects CUDA if available, else MPS if available, else CPU. Any other string is passed totorch.device. If the resolved device is CUDA or MPS but a test tensor cannot be allocated on it, CPU is used instead.
- device
- Return type:
- Returns:
The resolved
torch.device.