abracudabra.device.base#
Define the base device class.
Attributes#
The device type, e.g., |
|
The device types, e.g., |
Classes#
A device with a name and index. |
Functions#
|
Check if a device name is valid. |
|
Raise an error for an invalid device type. |
Module Contents#
- abracudabra.device.base.DEVICE_TYPES: frozenset[DeviceType][source]#
The device types, e.g.,
{"cpu", "cuda"}
.
- abracudabra.device.base.is_valid_device_type(device_type: str, /) TypeGuard[DeviceType] [source]#
Check if a device name is valid.
- abracudabra.device.base._raise_invalid_device_type(device_type: str, /) NoReturn [source]#
Raise an error for an invalid device type.
- class abracudabra.device.base.Device[source]#
Bases:
NamedTuple
A device with a name and index.
- classmethod validate(device: object, idx: object | None = None) Device [source]#
Return a device, validating the device name.