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

cannot run this EG on pytorch #5

Open
kathyliu579 opened this issue Apr 5, 2022 · 0 comments
Open

cannot run this EG on pytorch #5

kathyliu579 opened this issue Apr 5, 2022 · 0 comments

Comments

@kathyliu579
Copy link

kathyliu579 commented Apr 5, 2022

Traceback (most recent call last):
File "/home/qianying/PycharmProjects/DirectionalFeature-master/ES_ED_classfy/expected_gradient.py", line 161, in
expected_gradients = APExp.shap_values(net, inputs)
File "/home/qianying/PycharmProjects/DirectionalFeature-master/ES_ED_classfy/attributionpriors/pytorch_ops.py", line 151, in shap_values
grad_tensor = self._get_grads(samples_input, model, sparse_labels)
File "/home/qianying/PycharmProjects/DirectionalFeature-master/ES_ED_classfy/attributionpriors/pytorch_ops.py", line 120, in _get_grads
sparse_labels.unsqueeze(1)], dim=1)
AttributeError: 'NoneType' object has no attribute 'unsqueeze'

**but actually when we enter into APExp.shap_values(net, inputs), the sparse_labels is default as None.

def shap_values(self, model, input_tensor, sparse_labels=None,k=1):

please help to solve this problem. thanks**

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