Skip to content
fn

is_autocast_available

→bool
is_autocast_available(device_type: str)

Whether an autocast scope can be opened on device_type.

Parameters

device_typestr
A device type name.

Returns

bool

True for "metal" and "cpu", the two devices autocast accepts; False for any other name (it is a query, so an unknown name is an answer rather than an error).

Examples

>>> import lucid
>>> lucid.amp.is_autocast_available("cpu")
True
>>> lucid.amp.is_autocast_available("tpu")
False

Used by 1