It’s hard to tell why the code is failing as it seems that self.gradient is called internally in:
File “/home/Guest/.local/lib/python3.6/site-packages/shap/explainers/_deep/deep_pytorch.py”, line 185, 

which points to the used shap package. Could you cross-post the issue in their GitHub so that the code owners could also check if this is a known issue or is your usage of the package might be wrong?