torch.manual_seed(args.seed) #为CPU设置种子用于生成随机数,以使得结果是确定的
if args.cuda:
torch.cuda.manual_seed(args.seed) # 为当前GPU设置随机种子;
torch.cuda.manual_seed_all() # 使用多个GPU为所有的GPU设置种子。
torch.manual_seed(args.seed) #为CPU设置种子用于生成随机数,以使得结果是确定的
if args.cuda:
torch.cuda.manual_seed(args.seed) # 为当前GPU设置随机种子;
torch.cuda.manual_seed_all() # 使用多个GPU为所有的GPU设置种子。
您可能感兴趣的与本文相关的镜像
PyTorch 2.5
PyTorch 是一个开源的 Python 机器学习库,基于 Torch 库,底层由 C++ 实现,应用于人工智能领域,如计算机视觉和自然语言处理
4676
439
3814
1万+

被折叠的 条评论
为什么被折叠?