Pytorch与随机抽样。
实例:
import torch torch.manual_seed(1) mean = torch.rand(1, 2) std = torch.rand(1, 2) print(torch.normal(mean, std))
运行结果:
tensor([[0.7825, 0.7358]])
我们发现定义了随机数种子每次结果都是一样的。