torch.manual_seed(seed) # 为CPU设置随机种子torch.cuda.manual_seed(seed) # 为当前GPU设置随机种子torch.cuda.manual_seed_all(seed) # 为所有GPU设置随机种子