Anyway, do you mind providing a good example of how to use the torch.distributions.Uniform interface?
I saw the docs and the example in the linked issue but wasn’t very helpful. In particular what passing tensors of size larger than 1 do?
my specific question can be found here: https://github.com/pytorch/pytorch/issues/24162#issuecomment-658861894 1
copy pasted:


I think this already exists?
a = torch.tensor([0., 10.])
b = torch.tensor([1., 11.])
torch.distributions.Uniform(a, b).sample()
>>> tensor([ 0.8583, 10.0226])



This example is confusing me. What does uniform do when receiving tensors of size larger than 1x1 mean? Whats the behavior when they are greater than 1 dimension?

I saw the docs but they weren't helpful nor any example or discussion of the case you provides is given: https://pytorch.org/docs/stable/distributions.html#torch.distributions.uniform.Uniform

What I want is to replicate this numpy code:


xn = np.random.uniform(low=-1, high=1, size=(num_samples,Din))



Also what is the use of creating a sampler object first?