public class Device
Immutable execution-device selector or concrete device. gpu/npu denote automatic selection within one category, not multi-device execution. Indices are stable within a process. NVIDIA requires only a compatible GPU and its driver; no CUDA Toolkit is required. NPU execution is reserved and currently raises ValueException when explicitly selected.
model.to(Device.gpu[0]); print(model.device)
| Modifier and Type | Member | Description |
|---|---|---|
| public static readonly property | auto | Automatic selection according to operation support and estimated work. |
| public static readonly property | cpu | CPU execution only. |
| public static readonly property | gpu | Automatically chooses one supported GPU. |
| public readonly property | indexindex as Long |
Concrete GPU ordinal, or -1 for CPU/automatic selectors. |
| public readonly property | kindkind as String |
Category: auto, cpu, gpu or npu. |
| public readonly property | namename as String |
Human-readable name, without exposing the backend ABI. |
| public static readonly property | npu | Reserved NPU selector; execution is not implemented yet. |
| Modifier and Type | Member | Description |
|---|---|---|
| public static | list | Lists the CPU and detected NVIDIA GPUs; CPU is always present. |
| public override | toStringtoString() as String |
Returns the category, ordinal and device name. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | operator[](index as Long) as Device | Selects a concrete device in the GPU/NPU category. |