Skip to content

cannot run this EG on pytorch #5

@kathyliu579

Description

@kathyliu579

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**

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions