Question about .to(device)

Hi,

If I move a tensor to Cuda using .to(device), does it mean that then all the arithmetic operations done with that tensor will happen on Cuda?

Thanks.

My understanding is that any operation you do on the device will happen on GPU only, you can also use all the torch methods on that tensor and all the operations will also happen on GPU

Yes, It’s True. If you transfer a tensor on Cuda and then do any operation on that tensor, the operation happens on Cuda.

Thanks.