Can't transfer numpy array to GPU

I have a numpy array which I would like to shift to gpu. I used the method: from_numpy(numpy_array).float().to(device). However, I get the following error:

To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor)

This warning doesn’t make sense as .clone() method is not available for a numpy array. How can I move the said numpy array into a tensor on GPU?

The following code works for me:

import numpy as np
import torch
a = np.array([3., 2., 4.])
a_cuda = torch.from_numpy(a).to(device="cuda", dtype=torch.float32)

Note that I just use the to function to make the cast as well simply to avoid an extra copy.