seed = 2023
torch.manual_seed(seed) # torch的CPU随机性,为CPU设置随机种子
torch.cuda.manual_seed(seed) # torch的GPU随机性,为当前GPU设置随机种子
torch.cuda.manual_seed_all(seed) # torch的GPU随机性,为所有GPU设置随机种子
深度学习设置随机数种子
发布时间 2023-10-22 11:25:25作者: 孜孜不倦fly
seed = 2023
torch.manual_seed(seed) # torch的CPU随机性,为CPU设置随机种子
torch.cuda.manual_seed(seed) # torch的GPU随机性,为当前GPU设置随机种子
torch.cuda.manual_seed_all(seed) # torch的GPU随机性,为所有GPU设置随机种子