@ptrblck  Thank you so much for you reply, I tried that answer but I got same error
Here is the full error
‘’’  File “/mnt/train_model.py”, line 247, in 
shap_values = e.shap_values(sequence)
File “/home/Guest/.local/lib/python3.6/site-packages/shap/explainers/_deep/init.py”, line 124, in shap_values
return self.explainer.shap_values(X, ranked_outputs, output_rank_order, check_additivity=check_additivity)
File “/home/Guest/.local/lib/python3.6/site-packages/shap/explainers/_deep/deep_pytorch.py”, line 185, in shap_values
sample_phis = self.gradient(feature_ind, joint_x)
File "/home/Guest/.local/lib/python3.6/site-packages/shap/explainers/deep/deep_pytorch.py", line 123, in gradient
allow_unused=True)[0]
File “/home//Guest/.local/lib/python3.6/site-packages/torch/autograd/init.py”, line 229, in grad
grad_outputs = make_grads(outputs, grad_outputs)
File “/home//Guest/.local/lib/python3.6/site-packages/torch/autograd/init.py”, line 51, in _make_grads
raise RuntimeError(“grad can be implicitly created only for scalar outputs”)
RuntimeError: grad can be implicitly created only for scalar outputs ‘’’’