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