I am confused when modifying the official mnist example like this：
First,add something :
gpu=1
model = Net()
model = nn.DataParallel(model,device_ids=[1]).cuda(gpu)
And give parameter gpu to every cuda() below.
But after running the script,I find two GPU working.

image.png696×87 9.66 KB