torch.accelerator.set_device_index¶ torch.accelerator.set_device_index(device, /)[來源][來源]¶ 將目前的裝置索引設定為給定的裝置。 參數 device (torch.device, str, int) – 給定的裝置,必須符合目前的 加速器 裝置類型。 注意 如果此裝置索引為負數,則此函數不執行任何操作。