# Captum

**URL:** https://discuss.pytorch.org/c/captum/21.md?page=1

[Latest](https://discuss.pytorch.org/latest.md) · [Categories](https://discuss.pytorch.org/categories.md)

**Page:** 2

---

## [Expected tensor for argument #1 'indices' to have one of the following scalar types: Long, Int; but got torch.FloatTensor instead (while checking arguments for embedding)](https://discuss.pytorch.org/t/expected-tensor-for-argument-1-indices-to-have-one-of-the-following-scalar-types-long-int-but-got-torch-floattensor-instead-while-checking-arguments-for-embedding/167982)

<div class="topic-metadata">

**Author:** [@EvanZ](https://discuss.pytorch.org/u/EvanZ)\
**Replies:** 3\
**Last updated:** [April 21, 2023, 9:07am UTC](https://discuss.pytorch.org/t/expected-tensor-for-argument-1-indices-to-have-one-of-the-following-scalar-types-long-int-but-got-torch-floattensor-instead-while-checking-arguments-for-embedding/167982 "2023-04-21T09:07:23Z")

</div>

I have a simple forward method with two arguments each of which is a tensor of indices for embeddings: def forward(self, arg1, arg2): embed1 = self.embed1(arg1) embed2 = self.embed2(arg2) out = s…

---

## [Attribution understanding](https://discuss.pytorch.org/t/attribution-understanding/175012)

<div class="topic-metadata">

**Author:** [@KonstB](https://discuss.pytorch.org/u/KonstB)\
**Replies:** 0\
**Last updated:** [March 16, 2023, 10:22am UTC](https://discuss.pytorch.org/t/attribution-understanding/175012 "2023-03-16T10:22:15Z")

</div>

Hello. Can you help me with understanding of features attributions? I suppose, that they are connected to the feature importance, yes? I looked through California Housing example (Captum · Model Interpretability for Py…

---

## [IG & KernelShap do not add up to prediction?](https://discuss.pytorch.org/t/ig-kernelshap-do-not-add-up-to-prediction/173163)

<div class="topic-metadata">

**Author:** [@bko](https://discuss.pytorch.org/u/bko)\
**Replies:** 0\
**Last updated:** [February 21, 2023, 5:19pm UTC](https://discuss.pytorch.org/t/ig-kernelshap-do-not-add-up-to-prediction/173163 "2023-02-21T17:19:30Z")

</div>

Hi, Thanks so much for putting together such a great tool. :slight\_smile: So I am trying to use integrated gradients and SHAP on a complicated model, and my feature importance scores do not seem to add up to the model o…

---

## [Which methods yield high resolution maps?](https://discuss.pytorch.org/t/which-methods-yield-high-resolution-maps/172459)

<div class="topic-metadata">

**Author:** [@jrocha](https://discuss.pytorch.org/u/jrocha)\
**Replies:** 0\
**Last updated:** [February 13, 2023, 10:26am UTC](https://discuss.pytorch.org/t/which-methods-yield-high-resolution-maps/172459 "2023-02-13T10:26:36Z")

</div>

I am looking for Captum XAI methods that output a high resolution map, unlike Grad-CAM, whose heatmap is upsampled to the input image’s size. Which ones from the library yield high resolution heatmaps? Thank you in advan…

---

## [Add existing AxesSubplot object from visualize\_image\_attr\_multiple](https://discuss.pytorch.org/t/add-existing-axessubplot-object-from-visualize-image-attr-multiple/171367)

<div class="topic-metadata">

**Author:** [@Kalle](https://discuss.pytorch.org/u/Kalle)\
**Replies:** 1\
**Last updated:** [February 2, 2023, 1:10pm UTC](https://discuss.pytorch.org/t/add-existing-axessubplot-object-from-visualize-image-attr-multiple/171367 "2023-02-02T13:10:45Z")

</div>

I followed a tutorial from \[blog.paperspace.com\](https://blog.paperspace.com/model-interpretability-and-understanding-for-pytorch-using-captum/) where I used Captum to visualize what my model learns. Until now it works g…

---

## [Guided backprop interpretation for multilayer perceptron](https://discuss.pytorch.org/t/guided-backprop-interpretation-for-multilayer-perceptron/170765)

<div class="topic-metadata">

**Author:** [@neurospacer](https://discuss.pytorch.org/u/neurospacer)\
**Replies:** 0\
**Last updated:** [January 21, 2023, 4:49am UTC](https://discuss.pytorch.org/t/guided-backprop-interpretation-for-multilayer-perceptron/170765 "2023-01-21T04:49:25Z")

</div>

Hi, I want to use interpretation algorithm for simple feed-forward neural network (multilayer perceptron with 13 input neurons, 2 layers deep - 10 neurons each, output is 2 class) to classify voxels. Each input neuron …

---

## [Mat mul Shape error with Flatten layer when using gradcam](https://discuss.pytorch.org/t/mat-mul-shape-error-with-flatten-layer-when-using-gradcam/163440)

<div class="topic-metadata">

**Author:** [@IneedMrmeeseeks](https://discuss.pytorch.org/u/IneedMrmeeseeks)\
**Replies:** 3\
**Last updated:** [January 2, 2023, 8:42am UTC](https://discuss.pytorch.org/t/mat-mul-shape-error-with-flatten-layer-when-using-gradcam/163440 "2023-01-02T08:42:44Z")

</div>

Hi, I am newbie to captum and I have a problem that I can’t solve by myself. I trained ACGAN model and tried to apply gradcam on Discriminator part only. Input size is (1, 110, 408) This is my Discriminator / Critic p…

---

## [Tensor target dimension torch.Size(\[50, 2\]) is not valid. torch.Size(\[50, 2\]) - Captum](https://discuss.pytorch.org/t/tensor-target-dimension-torch-size-50-2-is-not-valid-torch-size-50-2-captum/130341)

<div class="topic-metadata">

**Author:** [@a\_d](https://discuss.pytorch.org/u/a_d)\
**Replies:** 1\
**Last updated:** [November 9, 2022, 6:48am UTC](https://discuss.pytorch.org/t/tensor-target-dimension-torch-size-50-2-is-not-valid-torch-size-50-2-captum/130341 "2022-11-09T06:48:38Z")

</div>

Hello all, I want to measure the feature importance in a multivariate time series. The model definition is as follows - class Network(nn.Module): def \_\_init\_\_(self, input\_size = 4, hidden\_dimensions = 16, num\_layers…

---

## [Semantic Segmentation with Captum, Feature Ablation](https://discuss.pytorch.org/t/semantic-segmentation-with-captum-feature-ablation/164366)

<div class="topic-metadata">

**Author:** [@Sega](https://discuss.pytorch.org/u/Sega)\
**Replies:** 0\
**Last updated:** [October 25, 2022, 11:12am UTC](https://discuss.pytorch.org/t/semantic-segmentation-with-captum-feature-ablation/164366 "2022-10-25T11:12:40Z")

</div>

Dear all, when reading through the segmentation tutorial I noticed that the logits, corresponding to pixels that are predicted to be a particular class, are summed. Since logits are unbounded, I was wandering why the ou…

---

## [Captum Atrribute Error](https://discuss.pytorch.org/t/captum-atrribute-error/163684)

<div class="topic-metadata">

**Author:** [@IneedMrmeeseeks](https://discuss.pytorch.org/u/IneedMrmeeseeks)\
**Replies:** 1\
**Last updated:** [October 17, 2022, 8:19am UTC](https://discuss.pytorch.org/t/captum-atrribute-error/163684 "2022-10-17T08:19:05Z")

</div>

Hi, I encountered an error while I am trying to run captum XAI API(such as GradCam and Saliency). This is the error. I can’t resolve this issue by myself. ---------------------------------------------------------------…

---

## [Accepted image formats for Captum Feature Attribution](https://discuss.pytorch.org/t/accepted-image-formats-for-captum-feature-attribution/154431)

<div class="topic-metadata">

**Author:** [@anmolseth00](https://discuss.pytorch.org/u/anmolseth00)\
**Replies:** 1\
**Last updated:** [August 21, 2022, 5:14pm UTC](https://discuss.pytorch.org/t/accepted-image-formats-for-captum-feature-attribution/154431 "2022-08-21T17:14:22Z")

</div>

The Captum tutorials all seem to be using .jpg images for feature attribution. Are other image formats accepted with their tutorial notebooks? If so, where can I find a list of accepted image formats? I wasn’t able to fi…

---

## [Image Mode not Accepted w/ Integrated Gradients](https://discuss.pytorch.org/t/image-mode-not-accepted-w-integrated-gradients/154168)

<div class="topic-metadata">

**Author:** [@anmolseth00](https://discuss.pytorch.org/u/anmolseth00)\
**Replies:** 3\
**Last updated:** [June 16, 2022, 7:53am UTC](https://discuss.pytorch.org/t/image-mode-not-accepted-w-integrated-gradients/154168 "2022-06-16T07:53:51Z")

</div>

I’m working with the integrated gradients notebook sourced from here:(Model Understanding with Captum — PyTorch Tutorials 2.2.0+cu121 documentation) “Download the notebook and corresponding files here.” I’m unable to …

---

## [LayerIntegratedGradients throwing error when using BART](https://discuss.pytorch.org/t/layerintegratedgradients-throwing-error-when-using-bart/147204)

<div class="topic-metadata">

**Author:** [@rsvarma](https://discuss.pytorch.org/u/rsvarma)\
**Replies:** 0\
**Last updated:** [March 23, 2022, 2:56am UTC](https://discuss.pytorch.org/t/layerintegratedgradients-throwing-error-when-using-bart/147204 "2022-03-23T02:56:13Z")

</div>

I was trying to adapt the BERT tutorial to work with BART. However, when I run the attribution, the forward function eventually breaks. After stepping through the code, I see that LayerIntegratedGradients runs the forwar…

---

## [Tutorial with pose estimation/captum](https://discuss.pytorch.org/t/tutorial-with-pose-estimation-captum/139075)

<div class="topic-metadata">

**Author:** [@Mukesh1729](https://discuss.pytorch.org/u/Mukesh1729)\
**Replies:** 0\
**Last updated:** [December 10, 2021, 3:17pm UTC](https://discuss.pytorch.org/t/tutorial-with-pose-estimation-captum/139075 "2021-12-10T15:17:48Z")

</div>

Is there any tutorial on using captum for pose estimation tasks that I can refer to? Thanks

---

## [Integrated Gradients with Captum in a sequential model](https://discuss.pytorch.org/t/integrated-gradients-with-captum-in-a-sequential-model/70399)

<div class="topic-metadata">

**Author:** [@key\_crusher](https://discuss.pytorch.org/u/key_crusher)\
**Replies:** 8\
**Last updated:** [December 9, 2021, 5:22pm UTC](https://discuss.pytorch.org/t/integrated-gradients-with-captum-in-a-sequential-model/70399 "2021-12-09T17:22:43Z")

</div>

Hi, I am using Integrated Gradients with a NN model that has both sequential (LSTM) and non sequential layers (MLP). I was following the basic steps as given in the examples and ran into a weird error. Code snippet: te…

---

## [Using captum with nn.Embedding getting RuntimeError](https://discuss.pytorch.org/t/using-captum-with-nn-embedding-getting-runtimeerror/134805)

<div class="topic-metadata">

**Author:** [@overflow\_question](https://discuss.pytorch.org/u/overflow_question)\
**Replies:** 1\
**Last updated:** [October 26, 2021, 10:21am UTC](https://discuss.pytorch.org/t/using-captum-with-nn-embedding-getting-runtimeerror/134805 "2021-10-26T10:21:35Z")

</div>

I am using captum library and getting following error. Here is complete code to reproduce the error. Appreciate if someone could help me here. Thank in advance. -OneQ- RuntimeError: One of the differentiated Tensors ap…

---

## [How to check correctness of implementation?](https://discuss.pytorch.org/t/how-to-check-correctness-of-implementation/134966)

<div class="topic-metadata">

**Author:** [@RylanSchaeffer](https://discuss.pytorch.org/u/RylanSchaeffer)\
**Replies:** 0\
**Last updated:** [October 24, 2021, 2:21am UTC](https://discuss.pytorch.org/t/how-to-check-correctness-of-implementation/134966 "2021-10-24T02:21:53Z")

</div>

I want to use captum to try to understand a fine-tuned language model using Integrated Gradients. I have an implementation that runs without raising any errors. Before looking at the results, what are good checks to tell…

---

## [Integrated Gradients - Convergence Delta as quality measure?](https://discuss.pytorch.org/t/integrated-gradients-convergence-delta-as-quality-measure/134383)

<div class="topic-metadata">

**Author:** [@brix](https://discuss.pytorch.org/u/brix)\
**Replies:** 0\
**Last updated:** [October 16, 2021, 10:20am UTC](https://discuss.pytorch.org/t/integrated-gradients-convergence-delta-as-quality-measure/134383 "2021-10-16T10:20:44Z")

</div>

Hi, I would like to use integrated gradients from captum to analyze a neuronal net: What can the return parameter “delta” be used for? What does a high delta actually mean for practical usage? Can or should I use it…

---

## [Regression based Importance feature](https://discuss.pytorch.org/t/regression-based-importance-feature/131290)

<div class="topic-metadata">

**Author:** [@sushmit\_roy](https://discuss.pytorch.org/u/sushmit_roy)\
**Replies:** 3\
**Last updated:** [September 20, 2021, 7:04pm UTC](https://discuss.pytorch.org/t/regression-based-importance-feature/131290 "2021-09-20T19:04:11Z")

</div>

How can I use a permutation-based importance feature using captum as an example https://scikit-learn.org/stable/modules/permutation\_importance.html

---

## [Optimizing Layer Conductance](https://discuss.pytorch.org/t/optimizing-layer-conductance/128686)

<div class="topic-metadata">

**Author:** [@ajhepburn](https://discuss.pytorch.org/u/ajhepburn)\
**Replies:** 1\
**Last updated:** [August 11, 2021, 10:01pm UTC](https://discuss.pytorch.org/t/optimizing-layer-conductance/128686 "2021-08-11T22:01:05Z")

</div>

So I’m currently at odds with how to approach this. At first, I was only really using Layer Conductance on a document-by-document basis. However, I’m now trying to scale this a little bit as I’m using the attributions to…

---

## [Model Interpretability using Captum](https://discuss.pytorch.org/t/model-interpretability-using-captum/127634)

<div class="topic-metadata">

**Author:** [@kountaydwivedi](https://discuss.pytorch.org/u/kountaydwivedi)\
**Replies:** 1\
**Last updated:** [July 25, 2021, 9:42pm UTC](https://discuss.pytorch.org/t/model-interpretability-using-captum/127634 "2021-07-25T21:42:56Z")

</div>

While using any model interpretability method, should we pass the train set or the test set as input parameter?

---

## [Does captum insights support Neuron Attribution?](https://discuss.pytorch.org/t/does-captum-insights-support-neuron-attribution/126092)

<div class="topic-metadata">

**Author:** [@zoombinis](https://discuss.pytorch.org/u/zoombinis)\
**Replies:** 0\
**Last updated:** [July 7, 2021, 2:54pm UTC](https://discuss.pytorch.org/t/does-captum-insights-support-neuron-attribution/126092 "2021-07-07T14:54:15Z")

</div>

I’ve followed the tutorial for Integrated Gradient visualization with Captum Insights, but what I’d really like to see is a UI that lets me visualize which neurons are responding to a given input image. Is this a featur…

---

## [Captum or XAI for yolo v5?](https://discuss.pytorch.org/t/captum-or-xai-for-yolo-v5/125592)

<div class="topic-metadata">

**Author:** [@tuttelikz](https://discuss.pytorch.org/u/tuttelikz)\
**Replies:** 0\
**Last updated:** [July 2, 2021, 3:18am UTC](https://discuss.pytorch.org/t/captum-or-xai-for-yolo-v5/125592 "2021-07-02T03:18:53Z")

</div>

Hi community! I wonder if anyone had experience to utilize captum like tools or any of XAI analysis techniques for yolo family models, particularly interested in yolo v5. Thanks!

---

## [X3d model and GradCam](https://discuss.pytorch.org/t/x3d-model-and-gradcam/125469)

<div class="topic-metadata">

**Author:** [@Shruti\_Verma](https://discuss.pytorch.org/u/Shruti_Verma)\
**Replies:** 0\
**Last updated:** [June 30, 2021, 1:24pm UTC](https://discuss.pytorch.org/t/x3d-model-and-gradcam/125469 "2021-06-30T13:24:58Z")

</div>

Hello, I would like some help in analysing x3d model results with captum grad cam, has anyone tried it ?

---

## [Integrated gradients for negative labeled examples](https://discuss.pytorch.org/t/integrated-gradients-for-negative-labeled-examples/121977)

<div class="topic-metadata">

**Author:** [@chsher](https://discuss.pytorch.org/u/chsher)\
**Replies:** 3\
**Last updated:** [June 23, 2021, 3:15am UTC](https://discuss.pytorch.org/t/integrated-gradients-for-negative-labeled-examples/121977 "2021-06-23T03:15:32Z")

</div>

How do I compute the feature attributions for negative labeled examples (i.e., target = 0) when the model output is a scalar? Currently, integrated gradients gives me the feature attributions for all examples wrt target …

---

## [Occlusion sensivity on 3D MRI images](https://discuss.pytorch.org/t/occlusion-sensivity-on-3d-mri-images/115214)

<div class="topic-metadata">

**Author:** [@Roshni\_Pathak](https://discuss.pytorch.org/u/Roshni_Pathak)\
**Replies:** 0\
**Last updated:** [March 18, 2021, 10:43am UTC](https://discuss.pytorch.org/t/occlusion-sensivity-on-3d-mri-images/115214 "2021-03-18T10:43:14Z")

</div>

hi all, I am working with occlusion sensitivity on a multimodal Network with 3D MRI. The code is executed without any error but no result is seen. Does this work with 3D data or just 2D. Can someone help me with it. Th…

---

## [Densenet121 and GuidedGradCam](https://discuss.pytorch.org/t/densenet121-and-guidedgradcam/114588)

<div class="topic-metadata">

**Author:** [@Pekka](https://discuss.pytorch.org/u/Pekka)\
**Replies:** 0\
**Last updated:** [March 12, 2021, 12:40pm UTC](https://discuss.pytorch.org/t/densenet121-and-guidedgradcam/114588 "2021-03-12T12:40:15Z")

</div>

I’m a bit newbie with Captum, but I’ve trained a Pytorch densenet121 based classified for 224x224 medical images. Four output classes. Now I’d like to interpret results with Captum’s Guided GradCAM. Since Densenets have …

---

## [Guided Gradcam on 3D images](https://discuss.pytorch.org/t/guided-gradcam-on-3d-images/112422)

<div class="topic-metadata">

**Author:** [@Roshni\_Pathak](https://discuss.pytorch.org/u/Roshni_Pathak)\
**Replies:** 1\
**Last updated:** [March 9, 2021, 3:26am UTC](https://discuss.pytorch.org/t/guided-gradcam-on-3d-images/112422 "2021-03-09T03:26:35Z")

</div>

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\_mode…

---

## [Occlusion Sensitivity-Sliding window shape](https://discuss.pytorch.org/t/occlusion-sensitivity-sliding-window-shape/113960)

<div class="topic-metadata">

**Author:** [@Roshni\_Pathak](https://discuss.pytorch.org/u/Roshni_Pathak)\
**Replies:** 1\
**Last updated:** [March 9, 2021, 3:14am UTC](https://discuss.pytorch.org/t/occlusion-sensitivity-sliding-window-shape/113960 "2021-03-09T03:14:15Z")

</div>

I am working with a tensor shape (\[1,9\]) and passing it as a tuple of bath size:2. I am unable to pass the right sliding window shape for Occlusion Model. Can you help me to know what would be the ideal input for slidi…

---

## [GuidedGradCam on EfficientNet](https://discuss.pytorch.org/t/guidedgradcam-on-efficientnet/111035)

<div class="topic-metadata">

**Author:** [@CarlosHernandezP](https://discuss.pytorch.org/u/CarlosHernandezP)\
**Replies:** 7\
**Last updated:** [February 8, 2021, 11:44am UTC](https://discuss.pytorch.org/t/guidedgradcam-on-efficientnet/111035 "2021-02-08T11:44:01Z")

</div>

I’ve been working with the EfficientNet architecture lately and I wanted to apply Captum’s GuidedGradCam on it but I am getting strange results: This is the code that I’m using: from models.efficientnet import Efficien…

[Previous page](https://discuss.pytorch.org/c/captum/21.md)

[Next page](https://discuss.pytorch.org/c/captum/21.md?page=2)
