suinleelab/attributionpriors

cannot run this EG on pytorch

kathyliu579 opened this issue · 0 comments

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