- torch.randn——标准正态分布normal
torch.randn(2, 3) #2行3列 定义输出张量形状的整数序列。
0.5419 0.1594 -0.0413
-2.7937 0.9534 0.4561
[torch.FloatTensor of size 2x3]
返回一个填充了标准正态分布中随机数的张量(均值为“0”,方差为“1”)
- torch.rand——均匀分布
torch.rand(2, 3)
0.0836 0.6151 0.6958
0.6998 0.2560 0.0139
[torch.FloatTensor of size 2x3]