设备 class torch.xpu.device(device)[source][source]¶ 上下文管理器,用于更改选定的设备。 参数: device (torch.device 或 int 或 str) – 要选择的设备索引。如果此参数为负整数或 None ,则不执行任何操作。