Python class
NPU
NPU
class max.driver.NPU(self, id: int = -1)
Bases: Accelerator
Creates an NPU accelerator device.
NPU is a subclass of Accelerator: an NPU is an
accelerator, and isinstance(device, Accelerator) returns
True for any NPU instance. The reason to construct an
NPU instead of a bare Accelerator is to select the NPU
dispatch path: the graph compiler stamps an "npu" device
label, emits target="npu" Mojo kernels, and routes through
the NPU plugin hook rather than the default GPU dispatch path.
On platforms without an NPU backend the device will still be created, but downstream graph compilation will fail with an unsupported target error.
from max import driver
device = driver.NPU()
device = driver.NPU(id=0)Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!