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