I am a beginner, I tried the tutorial and got this error:
Uniform, bernoulli, multinomial, normal distribution
2x2: A uniform distributed random matrix with range [0, 1]
r = torch.Tensor(2, 2).uniform_(0, 1)
bernoulli
r = torch.bernoulli® # Size: 2x2. Bernoulli with probability p stored in elements of r
Multinomial
w = torch.Tensor([0, 4, 8, 2]) # Create a tensor of weights
r = torch.multinomial(w, 4, replacement=True) # Size 4: 3, 2, 1, 2
Normal distribution
From 10 means and SD
r = torch.normal(means=torch.arange(1, 11), std=torch.arange(1, 0.1, -0.1)) # Size 10
TypeError Traceback (most recent call last)
in ()
14 # Normal distribution
15 # From 10 means and SD
—> 16 r = torch.normal(means=torch.arange(1, 11), std=torch.arange(1, 0.1, -0.1)) # Size 10
TypeError: normal() received an invalid combination of arguments - got (std=Tensor, means=Tensor, ), but expected one of:
- (Tensor mean, Tensor std, torch.Generator generator, Tensor out)
- (Tensor mean, float std, torch.Generator generator, Tensor out)
- (float mean, Tensor std, torch.Generator generator, Tensor out)
could someone know why?