0.3.0 torch.FloatTensor.to

The PyTorch version 0.3.0 I am using gives me an error with the following line.

loss = torch.zeros(1).to(pred_traj_gt)
AttributeError: 'torch.FloatTensor' object has no attribute 'to'

What should I replace the code with ? This is someone else code I am trying to run to understand. My GPU only allows me to use 0.3.0 so I cannot upgrade PyTorch. What should I replace the code with to have the same functionality ?

That dependa: do you want to change the device or the dtype with .to()?

I think its probably dtype.

I cannot test it because I don’t have a 0.3 env atm, but you should have a .type() method, which you should be able to call like .type(pred_traj_gt.dtype) or something similar.