nairbv:

Your second variant is copying the net to the device, but not assigning the copy to anything. to(device) is not an in-place operation, so this effectively doesn’t do anything.


Not sure if thats correct. It seems that there are no errors thrown (if I have data not in cuda/gpu the type of the tensor won’t match the net so an error would be thrown). So it seems that net.to(device) mutates my net and must put it in gpu…otherwise I would have seen an error thrown.
I wonder if this a unintended bug in pytorch and where they meant net = net.to(device) to be the only thing to work.