The .cuda() call is not necessary any more, as you’ve already created the tensor on the appropriate device.
If you don’t specify a device_id, cuda() will push the tensor back to the default device, e.g. 'cuda:0'.
I would recommend to use to(device) or the device attribute now instead of cuda() and cpu().