保证生成数据一致性
device调整为gpu生成
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
torch.cuda.manual_seed(0)
print(torch.rand(1, device=device))
保证生成数据一致性
device调整为gpu生成
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
torch.cuda.manual_seed(0)
print(torch.rand(1, device=device))
您可能感兴趣的与本文相关的镜像
PyTorch 2.8
PyTorch 是一个开源的 Python 机器学习库,基于 Torch 库,底层由 C++ 实现,应用于人工智能领域,如计算机视觉和自然语言处理
429
824
2348
325

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