Guided Gradcam on 3D images

I am using pytorch lightning and I am want to visualize my validation data using GradCAM.I am using a pretrained Resnet 3d model and this is the code I wrote:
my_model.eval()
guided_gc = GuidedGradCam(my_model, my_model.model.fc)
input_image = next(iter(mri_dataset.val_dataloader()))
attribution = guided_gc.attribute(input_image, 1)
Error:
assert isinstance(
AssertionError: inputs must have type torch.Tensor but <class ‘dict’> found:
my val_dataloader is a list of dictionary and I am unable to pass it properly. Kindly suggest how should I go about it and how can I also view the output.

Hi @Roshni_Pathak , inputs must be provided as a tensor or tuple of tensors to appropriately compute attributions. If the tensors are contained as values within the dictionary, then you can define a wrapper function which takes the tensors as input and constructs an appropriate dictionary and calls my_model with this dictionary. An example of this approach using a wrapper method with GuidedGradCam can be found in the discussion here. Hope this helps!