比较与torch.cuda.set_device的功能差异

torch.cuda.set_device

torch.cuda.set_device(device)

更多内容详见torch.cuda.set_device

mindspore.set_context

mindspore.set_context(**kwargs)

更多内容详见mindspore.set_context

使用方式

PyTorch:设置当前使用的device卡号。

MindSpore:不仅设置当前使用的device卡号,还设置模式mode,运行环境device_target,是否保存图save_graphs等。