设备 类torch.cuda.device(device)[源代码] 用于更改选定设备的上下文管理器。 参数 device (torch.device 或 int) – 设备索引。如果此参数为负整数或 None,则不会执行任何操作。