torch.cuda.synchronize#
- torch.cuda.synchronize(device=None)[原始碼]#
等待 CUDA 裝置上所有流中的所有核心執行完成。
- 引數
device (torch.device 或 int, 可選) – 需要同步的裝置。如果
device為None(預設值),則使用當前裝置,該裝置由current_device()給出。
等待 CUDA 裝置上所有流中的所有核心執行完成。
device (torch.device 或 int, 可選) – 需要同步的裝置。如果 device 為 None(預設值),則使用當前裝置,該裝置由 current_device() 給出。