Device
A compute device: a backend (cpu, cuda, vulkan, metal, htp, tpu) plus a device index. Built from the strings torch users type ("cpu", "cuda:0"); str(device) gives that string back.
index (property)
The device index within its backend (-1 for the whole-machine cpu).
type (property)
The backend name: "cpu", "cuda", "vulkan", "metal", "htp" or "tpu".
__init__
__init____init__(self, spec: str) -> None
init(self, spec: str) -> None init(self, type: str, index: int) -> None
Overloaded function.
__init__(self, spec: str) -> None
A device from its string form (the parse() grammar). Strings also convert implicitly, so device="cpu" works wherever a Device is taken.
__init__(self, type: str, index: int) -> None
A device from a backend name and an index: Device("cuda", 0).
cpu
cpu(*args, **kwargs)
cpu(index: int = -1) -> clika_runtime._core.Device
The whole-machine CPU by default; a non-negative index names one socket.
gpu
gpu(*args, **kwargs)
gpu(index: int = 0) -> clika_runtime._core.Device
The generic accelerator (resolved at call time; falls back to cpu() when no GPU backend is available).
parse
parse(*args, **kwargs)
parse(spec: str) -> clika_runtime._core.Device
Parse "