torch.cuda.get_rng_state¶ torch.cuda.get_rng_state(device='cuda')[source][source]¶ 返回指定 GPU 的随机数生成器状态,以 ByteTensor 形式返回。 参数 device (torch.device 或 int, 可选) – 要返回 RNG 状态的设备。默认值:'cuda' (即,torch.device('cuda'),当前 CUDA 设备)。 返回类型 Tensor 警告 此函数会立即初始化 CUDA。