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 命名空间中的操作尚未涵盖。