torch.accelerator.set_device_index¶ torch.accelerator.set_device_index(device, /)[source][source]¶ 设置当前设备索引为指定设备。 参数: 设备( torch.device ,str,int)- 必须匹配当前加速器设备类型的给定设备。 注意 如果此设备索引为负,则此函数为空操作(no-op)。