Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

help me!!!thank you AttributeError: 'function' object has no attribute 'register_forward_hook' #489

Open
Wud1 opened this issue Mar 11, 2024 · 0 comments

Comments

@Wud1
Copy link

Wud1 commented Mar 11, 2024

Traceback (most recent call last):
File "test.py", line 156, in main
result = indicator(**test_input)
File "../code/indicator/learning_indicator/_base.py", line 93, in _call_impl
score = self.get_result(**required_inputs)
File "../code/indicator/learning_indicator/DecomCam_PP/DecomCam_PP.py", line 62, in get_result
cam = DecomCAM(model=model, target_layers=target_layers)
File "../code/indicator/learning_indicator/DecomCam_PP/pytorch_grad_cam/decom_cam.py", line 67, in init
super(DecomCAM, self).init(
File "../code/indicator/learning_indicator/DecomCam_PP/pytorch_grad_cam/grad_cam_plusplus.py", line 10, in init
super(GradCAMPlusPlus, self).init(model, target_layers,
File "../code/indicator/learning_indicator/DecomCam_PP/pytorch_grad_cam/base_cam.py", line 37, in init
self.activations_and_grads = ActivationsAndGradients(
File "../code/indicator/learning_indicator/DecomCam_PP/pytorch_grad_cam/activations_and_gradients.py", line 13, in init
target_layer.register_forward_hook(self.save_activation))
AttributeError: 'function' object has no attribute 'register_forward_hook'
Exception ignored in: <function BaseCAM.del at 0x7f8373e03ca0>
Traceback (most recent call last):
File "../code/indicator/learning_indicator/DecomCam_PP/pytorch_grad_cam/base_cam.py", line 196, in del
self.activations_and_grads.release()
AttributeError: 'DecomCAM' object has no attribute 'activations_and_grads'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant