Yes, dtype is preferred 
You can actually do x = x.to(y), which returns a copy of x with the dtype and the device of y. If you only want to change the tensor’s dtype or device, but not both, then yeah, you woud do it with to(y.dtype)