Thanks @ptrblck. The problem I have with the “Tensor.new” function is that


If “a” is on GPU and “b” on CPU, then “a.new(b)” does not work (error: …constructor received an invalid combination of arguments…). “a.new(b.numpy())” works though, but I am afraid that it is inefficient.


If “a” and “b” are already on the same device, then “a.new(b)” will unnecessarily create a new copy of “b”


I am looking for a function like “b.type_as(a)”, but could automatically move the data to the same device as “a”.