2D Pytorch tensor doesn't have independent random values
Question
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.
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with datascience.stackexchange