含义 torch.manual_seed(parameter) #为CPU设置种子用于生成随机数,以使得结果是确定的 torch.cuda.manual_seed(parameter)#为当前GPU设置随机种 torch.cuda.manual_seed_all(parameter)#如果使用多个GPU,应该使用为所有的GPU设置种子。 其中parameter为int型变量 作用 设置唯一确定随机数种子,确保随机数种子不变,使得程序每次使用random函数均可获得同一随机值 参考By Florence_Janie