Function Differences with torch.cuda.set_device

View Source On Gitee

torch.cuda.set_device

torch.cuda.set_device(device)

For more information, see torch.cuda.set_device.

mindspore.context.set_context

mindspore.context.set_context(**kwargs)

For more information, see mindspore.context.set_context.

Differences

PyTorch: It is used to set the current device.

MindSpore:It is not only used to set the current device, but also set the mode, device_target, save_graphs, etc.