Legitimate way to move module or tensor to GPU?

I have seen two ways to move module or tensor to GPU:

Is there any difference between these two methods in terms of moving module or tensor to GPU? Which method is preferred?

No

.to is preferred because you can define a device object and use it everywhere.

1 Like