Function Differences with torch.cuda.set_device

View Source On Gitee

torch.Tensor.cuda

torch.Tensor.cuda()

For more information, see torch.Tensor.cuda.

mindspore.context.set_context

mindspore.context.set_context(**kwargs)

For more information, see mindspore.context.set_context.

Differences

PyTorch: It is used to copy object in CUDA memory.

MindSpore:When set parameter device_target='GPU' or device_target='Ascend', Network and Tensor are copied to GPU/Ascend device automatically.