評價此頁

torch.cuda.manual_seed#

torch.cuda.manual_seed(seed)[原始碼]#

設定當前 GPU 隨機數生成的種子。

如果 CUDA 不可用,呼叫此函式是安全的;在這種情況下,它將被靜默忽略。

引數

seed (int) – 期望的種子。

警告

如果您正在使用多 GPU 模型,此函式不足以實現確定性。要設定所有 GPU 的種子,請使用 manual_seed_all()