← 返回首页
Pytorch与随机抽样
发表时间:2024-01-23 01:47:12
Pytorch与随机抽样

Pytorch与随机抽样。

1.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]])

我们发现定义了随机数种子每次结果都是一样的。