Problem with Shap Deep Explainer in fastai model

Implemented a simple image classification model in fastai using the resnet18 architecture.
learner in fastai

learn = Learner(dls, arch, loss_func=CrossEntropyLossFlat(), metrics=[accuracy, f1score],
                                opt_func=ranger,
                                 cbs=[EarlyStoppingCallback(patience = 10, monitor = 'f1_score'),
                                     SaveModelCallback(fname='cat_vs_dog_rs18',
                                                      monitor='f1_score',
                                                      reset_on_fit = False), 
                                     ReduceLROnPlateau()])

e = shap.DeepExplainer(learn.model, background)
After running shap_values the following errors appear
shap_values = e.shap_values(test_images)

The below errors and warnings appear

Warning: unrecognized nn.Module: Flatten
Warning: unrecognized nn.Module: AdaptiveMaxPool2d
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-63-c68d6304d8ee> in <module>()
----> 1 shap_values = e.shap_values(test_images)

7 frames
/usr/local/lib/python3.6/dist-packages/torch/autograd/__init__.py in grad(outputs, inputs, grad_outputs, retain_graph, create_graph, only_inputs, allow_unused)
    202     return Variable._execution_engine.run_backward(
    203         outputs, grad_outputs_, retain_graph, create_graph,
--> 204         inputs, allow_unused)
    205 
    206 

RuntimeError: hook 'deeplift_grad' has changed the size of the value

Could anyone suggest a fix for this problem