torch.cuda.set_sync_debug_mode¶ torch.cuda.set_sync_debug_mode(debug_mode)[source][source]¶ 設定 CUDA 同步操作的除錯模式。 引數 debug_mode (str 或 int) – 如果為 “default” 或 0,則不同步操作時報錯或警告;如果為 “warn” 或 1,則同步操作時發出警告;如果為 “error” 或 2,則同步操作時報錯。 警告 這是一項實驗性功能,並非所有同步操作都會觸發警告或錯誤。特別是,torch.distributed 和 torch.sparse 名稱空間中的操作尚未涵蓋。