torch.cuda.manual_seed_all torch.cuda.manual_seed_all(seed)[源代码] 为所有GPU上的随机数生成设置种子。 如果 CUDA 不可用,调用此函数是安全的;在这种情况下,该函数会被默默忽略。 参数 seed (int) – 指定的随机种子值。