docs/cpp/source/api/xpu/index.md
PyTorch provides XPU support for Intel GPU-accelerated tensor operations. The XPU API allows you to manage Intel GPU devices, streams for asynchronous execution, and synchronization.
When to use XPU APIs:
Basic usage:
#include <torch/torch.h>
// Check if XPU is available
if (torch::xpu::is_available()) {
// Create tensor on XPU
auto tensor = torch::randn({2, 3}, torch::device(torch::kXPU));
// Move model to XPU
model->to(torch::kXPU);
}
torch/xpu.h - High-level XPU utilities (device count, availability, seeding)c10/xpu/XPUStream.h - XPU stream management:maxdepth: 1
streams
utilities