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。