pooya-mohammadi / yolov5-gradcam

Visualizing Yolov5's layers using GradCam

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Get RuntimeError when using `register_full_backward_hook`

Wenxc opened this issue · comments

hey, I encountered an error when running the register_backward_hook
firstly, its just a warning:
UserWarning: Using a non-full backward hook when the forward contains multiple autograd Nodes is deprecated and will be removed in future versions. This hook will be missing some grad_input. Please use register_full_backward_hook to get the documented behavior.
it's deprecated after 1.8.0 so I replace the register_backward_hook with register_full_backward_hook as told, but this time I get an error:
RuntimeError: Output 0 of BackwardHookFunctionBackward is a view and is being modified inplace. This view was created inside a custom Function (or because an input was returned as-is) and the autograd logic to handle view+inplace would override the custom backward associated with the custom Function, leading to incorrect gradients. This behavior is forbidden. You can fix this by cloning the output of the custom Function. I googled for a long time and still didnt get a good resolution.
Do you have any idea?

and I am using:
PyTorch: 1.10.0
torchvision 0.11.2
Python 3.9.7
OS: ubuntu1804

@Wenxc
I updated the model, why don't you check it again!

Have you solved it yet