[英]torch.manual_seed(seed) get RuntimeError: CUDA error: device-side assert triggered
[英]Does torch.manual_seed include the operation of torch.cuda.manual_seed_all?
torch.manual_seed
是否包含torch.cuda.manual_seed_all
的操作?
如果是,我們可以使用torch.manual_seed
來設置種子。 否則我們應該調用這兩個函數。
是的, torch.manual_seed()
確實包括 CUDA:
您可以使用
torch.manual_seed()
為所有設備(CPU 和 CUDA)播種 RNG:
請參閱Pytorch 閃電的seed_everything
:
random.seed(seed)
np.random.seed(seed)
torch.manual_seed(seed)
torch.cuda.manual_seed_all(seed)
讓我相信這些都是而且只是所需的種子。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.