训练神经网络出现以下报错。
Variable._execution_engine.run_backward( # Calls into the C++ engine to run the backward pass
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.
Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions.
原因:
神经网络最后的全连接层的神经元的数量和label中的标签,对应不上,我的错误是,我有41个类,但是最后我的全连接层只有40个神经元,所以出现这个错误。