设置了随机种子但是结果不可复现

1.pytorch_geometric代码不可复现

使用了很多scatter操作,不能保证确定性,使用cpu跑代码可以复现

 

2.使用下面这个命令可以检查代码中是否有不确定性的代码

torch.use_deterministic_algorithms(True)

3.某些函数的确定性支持在更高版本的pytorch可能已经解决

 

相关链接:

https://github.com/pyg-team/pytorch_geometric/issues/92

https://pytorch.org/docs/stable/notes/randomness.html

https://github.com/pytorch/pytorch/pull/79466

posted @ 2023-04-26 11:59  お兄ちゃん~  阅读(391)  评论(0)    收藏  举报