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

AttributeError for ScoreCAM Class #528

Closed
dwil2444 opened this issue Sep 3, 2024 · 3 comments
Closed

AttributeError for ScoreCAM Class #528

dwil2444 opened this issue Sep 3, 2024 · 3 comments

Comments

@dwil2444
Copy link

dwil2444 commented Sep 3, 2024

Issue: AttributeError for ScoreCAM Class

Description

I encountered an AttributeError when using the ScoreCAM class from the pytorch_grad_cam package. The error message is as follows:

`AttributeError: 'ScoreCAM' object has no attribute 'device'

Code Context

In the ScoreCAM class, the line causing the error is:
activation_tensor = activation_tensor.to(self.device)

Expected Behavior

The ScoreCAM class should either:

Initialize self.device properly, or
Avoid using self.device if it is not applicable.

Possible Solution:

One potential fix would be to pass device as a param to the constructor

Steps to Reproduce:

Initialize a ScoreCAM object.
Call the object with

@jacobgil
Copy link
Owner

jacobgil commented Sep 4, 2024

Hi,
I can't reproduce this.
ScoreCAM inherits from BaseCAM which does have a self.device attribute.

Could you please share more information - which version are you using ?

@dwil2444
Copy link
Author

dwil2444 commented Sep 4, 2024

Could you please share more information - which version are you using ?

Version 1.4.8

@jacobgil
Copy link
Owner

jacobgil commented Sep 4, 2024

This should be fixed in the latest releases. Could you please try upgrading the package ?

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

2 participants