pooya-mohammadi / yolov5-gradcam

Visualizing Yolov5's layers using GradCam
MIT License
281 stars 47 forks source link

Get RuntimeError when using `register_full_backward_hook` #7

Open Wenxc opened 2 years ago

Wenxc commented 2 years ago

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_backwardhook to get the documented behavior. it's deprecated after 1.8.0 so I replace the _register_backwardhook with _register_full_backwardhook 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

pooya-mohammadi commented 2 years ago

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

zidaman commented 1 year ago

Have you solved it yet