torch.cuda.set_sync_debug_mode¶ torch.cuda.set_sync_debug_mode(debug_mode)[源代码]¶ 设置用于 CUDA 同步操作的调试模式。 Parameters debug_mode (str 或 int) – 如果为“default”或0,不在同步操作时报错或警告, 如果为“warn”或1,在同步操作时警告,如果为“error”或2,在同步操作时报错。 警告 这是一个实验性功能,并非所有同步操作都会触发警告或错误。特别是,torch.distributed 和 torch.sparse 命名空间中的操作尚未覆盖。