yizt/Grad-CAM.pytorch

AttributeError: 'NoneType' object has no attribute 'zero_'

Wiikk opened this issue · 2 comments

Wiikk commented

Hi, thanks for sharing the code.
I use Grad-CAM in my own classification model, but I got the following error and can't fix it.
Could you please figure out the solutions? Thanks.

Traceback (most recent call last):
File "/remote-home/my/Code/baseline/CAM_Visual.py", line 289, in
main(config, args)
File "/remote-home/my/Code/baseline/CAM_Visual.py", line 252, in main
inputs.grad.zero_() # 梯度置零
AttributeError: 'NoneType' object has no attribute 'zero_'

hi, I had the same problem, How did you solve it?

这个问题怎么解决?