Cuda Runtime Error using expand


I am getting a: cuda runtime error (8) : invalid device function with this code:

   import torch

   x = torch.rand(10, 1).cuda()
   y = torch.rand(10, 300).cuda()


This code works fine without cuda.
Is that a bug ? What am I doing wrong ?

Note that the expand function itself is not producing the error, it is the print. However, it looks like the object returned by expand is incorrect since it produces other errors if used.