See More

XPU device backend brings native Intel GPU support to PyTorch, enabling performant training and inference on both Linux and Windows.<\/p>\n

Prerequisites<\/h2>\n

The system with configured Intel GPU card is required. For detailed list of supported devices and driver install instructions refer to Getting Started on Intel GPU<\/a>.<\/p>\n

Installation<\/h2>\n

pip<\/h3>\n

Use the pip package manager to install PyTorch with XPU support. Select your preferred options in the selector above to get the installation command.<\/p>\n

Verification<\/h2>\n

To ensure that PyTorch was installed correctly with XPU support, run the following code:<\/p>\n

<\/span>import<\/span> <\/span>torch<\/span>\nprint<\/span>(<\/span>torch<\/span>.<\/span>__version__<\/span>)<\/span>\n\n# Check XPU availability<\/span>\nif<\/span> torch<\/span>.<\/span>xpu<\/span>.<\/span>is_available<\/span>():<\/span>\n    print<\/span>(<\/span>"XPU is available!"<\/span>)<\/span>\n    print<\/span>(<\/span>f<\/span>"XPU devices: <\/span>{<\/span>torch<\/span>.<\/span>xpu<\/span>.<\/span>device_count<\/span>()<\/span>}<\/span>"<\/span>)<\/span>\nelse<\/span>:<\/span>\n    print<\/span>(<\/span>"XPU is not available."<\/span>)<\/span>\n<\/code><\/pre><\/div>\n\n

The following, or a similar output, indicates successful installation:<\/p>\n

<\/span>2<\/span>.13.0+xpu\nXPU <\/span>is <\/span>available!\nXPU <\/span>devices: <\/span>4<\/span>\n<\/code><\/pre><\/div>\n\n

Installing on Ascend NPU<\/h1>\n

Ascend for PyTorch (TorchNPU)<\/strong> is a deep learning adaptation framework built on Ascend. It enables Ascend NPUs to support the PyTorch framework, delivering the powerful computing capabilities of Ascend AI processors to PyTorch developers and users.<\/p>\n

Prerequisites<\/h2>\n

Hardware Requirements<\/h3>\n

Documentation<\/h2>\n

For more information, please visit the torch.xpu<\/a>.<\/p>","ascend_npu":"