Which version of PyTorch are you running on?
For PyTorch version: 0.4.1 when I run the following I get no error
>>> import torch.distributions.dirichlet as d
>>> m = d.Dirichlet(torch.tensor([0.5, 0.5], device='cuda'))
>>> m.sample()
tensor([0.5290, 0.4710], device='cuda:0')

Could you provide some code that causes this error?
If you are on 0.4 you can try upgrading to 0.4.1 and see if that fixes your error.
You can do that by running conda update pytorch -c pytorch