2D Pytorch tensor doesn't have independent random values I've written some Python to create a pytorch tensor of random values, sampled from a Student's t distribution with 10 degrees of freedom:

t = torch.Tensor(())
def random_from(shape):
    return torch.distributions.StudentT(10, t.new_zeros(shape), t.new_ones(shape)).sample()


If shape is of the form $(n, m)$, all values in the resulting 2D tensor are identical. I don't understand why. I did try reading Pytorch's documentation, but I couldn't find anything that helped me understand what would be a better syntax. I suppose I could create separate samples then concatenate them, but apart from the speed implications I'd like to know where my existing syntax goes wrong.
You don't use the parameters "loc" and "scale" the right way. They are not suppose to be tensors. Bellow the right syntax : 

dist = torch.distributions.StudentT(10, 0, 1)
dist = torch.distributions.StudentT(10) # 0 and 1 are the default parameters


Then you can sample multiple values like that :

t = dist.rsample(torch.Size([n,m]))
t = dist.rsample(torch.Size([n]))