class_docstr: Compute averaged sensitivity map based on ``n_samples`` (Gaussian additive) of noisy versions
  of the input image ``x``.
  
  See also:
  
      - Smilkov et al. SmoothGrad: removing noise by adding noise https://arxiv.org/abs/1706.03825
class_docstr_tok: ["Compute","averaged","sensitivity","map","based","on","``","n_samples","``","(","Gaussian","additive",")","of","noisy","versions","of","the","input","image","``","x","``",".","See","also",":","-","Smilkov","et","al",".","SmoothGrad",":","removing","noise","by","adding","noise","https",":","\/\/arxiv.org\/abs\/1706.03825"]
code: def __call__(
      self,
      x: torch.Tensor,
      index: torch.Tensor | int | None = None,
      **kwargs: Any,
  ) -> torch.Tensor:
      stdev = (self.stdev_spread * (x.max() - x.min())).item()
      total_gradients = torch.zeros_like(x)
      for _ in self.range(self.n_samples):
          # create noisy image
          noise = torch.normal(
              0,
              stdev,
              size=x.shape,
              dtype=torch.float32,
              device=x.device,
          )
          x_plus_noise = x + noise
          x_plus_noise = x_plus_noise.detach()
  
          # get gradient and accumulate
          grad = self.get_grad(x_plus_noise, index, **kwargs)
          total_gradients += (grad * grad) if self.magnitude else grad
  
      # average
      if self.magnitude:
          total_gradients = total_gradients**0.5
  
      return total_gradients / self.n_samples
  
imports: from __future__ import annotations
  from functools import partial
  from typing import Any, Callable
  import torch
  from monai.networks.utils import replace_modules_temp
  from monai.utils.module import optional_import
  from monai.visualize.class_activation_maps import ModelWithHooks
label_desc: Use image node_id 2 for calling the SmoothGrad obj's underlying member method code with example usage: obj.__call__(x, index) and returns: unknown