torch.cuda.manual_seed¶ torch.cuda.manual_seed(seed)[source][source]¶ 为当前 GPU 设置生成随机数的种子。 如果 CUDA 不可用,调用此函数是安全的;在这种情况下,它将被静默忽略。 参数 seed (int) – 所需的种子。 警告 如果您正在使用多 GPU 模型,则此函数不足以获得确定性。要为所有 GPU 设置种子,请使用 manual_seed_all()。