评价此页

torch.cuda.seed#

torch.cuda.seed()[source]#

将当前 GPU 随机数生成的种子设置为一个随机数。

如果 CUDA 不可用,调用此函数是安全的;在这种情况下,它将被静默忽略。

警告

If you are working with a multi-GPU model, this function will only initialize the seed on one GPU. To initialize all GPUs, use seed_all().