Compute the actual feature map with input tensor `x`. Args: x: input to `nn_module`. class_idx: index of the class to be visualized. Default to `None` (computing `class_idx` from `argmax`) layer_idx: index of the target layer if there are multipl
(self, x, class_idx=None, layer_idx=-1)
| 192 | return self.compute_map(torch.zeros(*input_size, device=device), layer_idx=layer_idx, **kwargs).shape |
| 193 | |
| 194 | def compute_map(self, x, class_idx=None, layer_idx=-1): |
| 195 | """ |
| 196 | Compute the actual feature map with input tensor `x`. |
| 197 | |
| 198 | Args: |
| 199 | x: input to `nn_module`. |
| 200 | class_idx: index of the class to be visualized. Default to `None` (computing `class_idx` from `argmax`) |
| 201 | layer_idx: index of the target layer if there are multiple target layers. Defaults to -1. |
| 202 | |
| 203 | Returns: |
| 204 | activation maps (raw outputs without upsampling/post-processing.) |
| 205 | """ |
| 206 | raise NotImplementedError() |
| 207 | |
| 208 | def _upsample_and_post_process(self, acti_map, x): |
| 209 | # upsampling and postprocessing |