How to create a tensor on GPU as default

Hi, here is my code:

import torch
torch.set_default_tensor_type(‘torch.cuda.FloatTensor’)
t = torch.rand(1,3,24,24)

and it caused bellow error:

TypeError Traceback (most recent call last)
in ()
----> 1 t = torch.rand(1,3,24,24)

TypeError: Type torch.cuda.FloatTensor doesn’t implement stateless methods

Any idea for this type of error?