设备¶ class torch.xpu.device(device)[源代码]¶ 上下文管理器,用于更改所选设备。 Parameters 设备 (torch.device 或 整数 或 字符串) – 要选择的设备索引。如果此参数为负整数或 None,则此操作无效。