The question says it all. I want to get a 2-D torch.Tensor
with size [a,b]
filled with values from a uniform distribution (in range [r1,r2]
To get a uniform random distribution, you can use
torch.distributions.uniform.Uniform()
example,
import torch
from torch.distributions import uniform
distribution = uniform.Uniform(torch.Tensor([0.0]),torch.Tensor([5.0]))
distribution.sample(torch.Size([2,3])
This will give the output, tensor of size [2, 3].