PyTorch | torch.manual_seed(1)是什么意思?torch随机数manual_seed(1)有什么用?如何理解torch.manual_seed(1)
torch.manual_seed(1)是为了设置CPU的的随机数固定,使得紧跟着的rand()函数生成的值是固定的随机!# 王博Kingsimport torchtorch.manual_seed(1)print(torch.rand(5))tensor([0.7576, 0.2793, 0.4031, 0.7347, 0.0293])# 王博Kingstorch.manual_seed(2)print(torch.rand(5))tensor([0.6147, 0.38