< Back
Env
import torch
 
randn
R = torch.randn(2, 3)
What's this?
标准高斯分布(正态分布)
均值: 0, 标准差: 1
R
R
tensor([[-0.6154, 0.5752, -0.1406],
[ 1.0015, -0.1382, -1.0266]])
R.shape
R.shape
torch.Size([2, 3])
R.numel()
R.numel()
6
 
rand
R2 = torch.rand(2, 3)
What's this?
[0, 1) 之间的均匀分布
R2
R2
tensor([[0.7229, 0.9248, 0.7824],
[0.5227, 0.5255, 0.0237]])
R2.shape
R2.shape
torch.Size([2, 3])
R2.numel()
R2.numel()
6