MY code snippet is already performing operations on the device via:
y = torch.randn(1).cuda() + torch.randn(1).cuda()

and while it works for me, it seems that @marewi is still hitting the issue.
Are you seeing the same error using my code snippet?