unilab.utils.device.resolve_torch_device_alias

unilab.utils.device.resolve_torch_device_alias(device, *, default='cpu')[source]

Resolve a cross-platform torch device alias to a concrete device string.

gpu is an abstract accelerator alias. cuda is also accepted on macOS/MPS for config portability and maps to mps when CUDA is absent. The function validates the resolved device and never silently falls back to CPU for unavailable accelerators.

Parameters:
Return type:

str