I don’t know what shap_values is calling internally, but the error message indicates that backward() is called on a tensor, which contains more than a single element (i.e. isn’t a scalar tensor).
In these cases you would either need to reduce the tensor to a scalar (e.g. via torch.mean) or would need to provide a gradient tensor to backward via tensor.backward(grad), where grad has the same shape as tensor.