I want to create a random normal distribution in pytorch and mean and std are 4, 0.5 respectively. I didn\'t find a API for it. Anyone knows? Thanks very much.
You can create your distribution like described here in the docs. In your case this should be the correct call, including sampling from the created distribution:
from torch.distributions import normal
m = normal.Normal(4.0, 0.5)
s = m.sample()
If you want to get a sample of a certain size/shape, you can pass it to sample(), for example
s = m.sample([5, 5])
for a 5x5-Tensor.