get_device#
- composer.utils.get_device(device=None)[source]#
Takes string or Device and returns the corresponding
Device
.- Parameters
device (str | Device, optional) โ A string corresponding to a device (one of
'cpu'
,'gpu'
,'mps'
, or'tpu'
) or aDevice
. (default:None
)- Returns
Device โ Device corresponding to the passed string or Device. If no argument is passed, returns
DeviceGPU
if available, orDeviceCPU
if no GPU is available.