In modern PyTorch, you just say float_tensor.double() to cast a float tensor to double tensor. There are methods for each type you want to cast to. If, instead, you have a dtype and want to cast to that, say float_tensor.to(dtype=your_dtype) (e.g., your_dtype = torch.float64)