Bug小能手系列(python)

小明 2025-04-29 20:16:49 4

Python运行代码报错

  • 0 引言
  • 1 报错原因
  • 2 解决思路
  • 3. 总结

0 引言

在运行 Python 代index.php/tags-41973.html" class="superseo">���时出现报错:

RuntimeError: CUDA error: device-side assert triggered CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect. For debugging consider passing CUDA_LAUNCH_BLOCKING=1.

注意:报错对应的代码部分与实际出现错误的部分是不同的。具体报错截图如下所示:

1 报错原因

当代码中存在数组越界或者标签不一致的时候就会出现该错误。这里说的标签不一致的意思是:模型输入的标签应该是0-3,但是你实际输入的标签是1-

The End
微信