torch.cuda.manual_seed¶ torch.cuda.manual_seed(seed)[原始碼][原始碼]¶ 設定目前 GPU 產生隨機數的種子。 如果 CUDA 無法使用,可以安全地呼叫此函數;在這種情況下,它會被靜默地忽略。 參數 seed (int) – 所需的種子。 警告 如果您正在使用多 GPU 模型,此函數不足以獲得確定性結果。 要為所有 GPU 設定種子,請使用 manual_seed_all()。