xnn.common.train.trainer.resolve_device#
- xnn.common.train.trainer.resolve_device(name)[source]#
Resolve a device specification string into a
torch.device.- Parameters:
name (str) – Device name. The special value
"auto"selects"cuda"when a CUDA device is available and falls back to"cpu"otherwise. Any other value is passed through totorch.deviceunchanged (e.g."cpu","cuda","cuda:1").- Returns:
The resolved device.
- Return type: