提问人:amew646 提问时间:11/2/2023 最后编辑:amew646 更新时间:11/2/2023 访问量:46
为什么 torch.randn 不能在所有播种中重现?
Why is torch.randn not been reproducible with all seeding?
问:
标题说明了一切,这是我的问题:
我希望是可重复的。torch.randn(1)
我正在使用:
CUDA:12.1
TCC/WDDM系列
VS Code Jupyter
并尝试了以下方法。seed
seed=42
torch.manual_seed(seed=seed)
torch.cuda.manual_seed_all(seed=seed)
np.random.seed(seed=seed)
torch.backends.cudnn.deterministic = True
torch.use_deterministic_algorithms(True)
torch.backends.cudnn.benchmark = False
torch.randn(1)
我第一次单独尝试,但无法重现。torch.manual_seed(seed=seed)
我期望有一个常量值作为输出。
答: 暂无答案
评论
torch.manual_seed(seed=seed)
足以在我的系统上实现可重复性。这可能是特定于硬件的错误吗?