class_docstr: Adds gaussian noise to each input in the batch `nt_samples` times
  and applies the given attribution algorithm to each of the samples.
  The attributions of the samples are combined based on the given noise
  tunnel type (nt_type):
  If nt_type is `smoothgrad`, the mean of the sampled attributions is
  returned. This approximates smoothing the given attribution method
  with a Gaussian Kernel.
  If nt_type is `smoothgrad_sq`, the mean of the squared sample attributions
  is returned.
  If nt_type is `vargrad`, the variance of the sample attributions is
  returned.
  
  More details about adding noise can be found in the following papers:
  
      * https://arxiv.org/abs/1810.03292
      * https://arxiv.org/abs/1810.03307
      * https://arxiv.org/abs/1706.03825
      * https://arxiv.org/abs/1806.10758
  
  This method currently also supports batches of multiple examples input,
  however it can be computationally expensive depending on the model,
  the dimensionality of the data and execution environment.
  It is assumed that the batch size is the first dimension of input tensors.
class_docstr_tok: ["Adds","gaussian","noise","to","each","input","in","the","batch","`","nt_samples","`","times","and","applies","the","given","attribution","algorithm","to","each","of","the","samples",".","The","attributions","of","the","samples","are","combined","based","on","the","given","noise","tunnel","type","(","nt_type",")",":","If","nt_type","is","`","smoothgrad","`",",","the","mean","of","the","sampled","attributions","is","returned",".","This","approximates","smoothing","the","given","attribution","method","with","a","Gaussian","Kernel",".","If","nt_type","is","`","smoothgrad_sq","`",",","the","mean","of","the","squared","sample","attributions","is","returned",".","If","nt_type","is","`","vargrad","`",",","the","variance","of","the","sample","attributions","is","returned",".","More","details","about","adding","noise","can","be","found","in","the","following","papers",":","*","https",":","\/\/arxiv.org\/abs\/1810.03292","*","https",":","\/\/arxiv.org\/abs\/1810.03307","*","https",":","\/\/arxiv.org\/abs\/1706.03825","*","https",":","\/\/arxiv.org\/abs\/1806.10758","This","method","currently","also","supports","batches","of","multiple","examples","input",",","however","it","can","be","computationally","expensive","depending","on","the","model",",","the","dimensionality","of","the","data","and","execution","environment",".","It","is","assumed","that","the","batch","size","is","the","first","dimension","of","input","tensors","."]
docstr: Args:
      attribution_method (Attribution): An instance of any attribution algorithm
                  of type `Attribution`. E.g. Integrated Gradients,
                  Conductance or Saliency.
docstr_tok: ["Args",":","attribution_method","(","Attribution",")",":","An","instance","of","any","attribution","algorithm","of","type","`","Attribution","`",".","E.g",".","Integrated","Gradients",",","Conductance","or","Saliency","."]
code: def __init__(self, attribution_method: Attribution) -> None:
      r"""
      Args:
          attribution_method (Attribution): An instance of any attribution algorithm
                      of type `Attribution`. E.g. Integrated Gradients,
                      Conductance or Saliency.
      """
      self.attribution_method = attribution_method
      self.is_delta_supported = (
          self.attribution_method.has_convergence_delta()
      )
      self._multiply_by_inputs = (
          self.attribution_method.multiplies_by_inputs
      )
      self.is_gradient_method = isinstance(
          self.attribution_method, GradientAttribution
      )
      Attribution.__init__(self, self.attribution_method.forward_func)
  
file_path: captum/captum/attr/_core/noise_tunnel.py
imports: from enum import Enum
  from typing import Any, cast, List, Tuple, Union
  import torch
  from captum._utils.common import _expand_and_update_additional_forward_args, _expand_and_update_baselines, _expand_and_update_feature_mask, _expand_and_update_target, _format_output, _format_tensor_into_tuples, _is_tuple
  from captum._utils.typing import TensorOrTupleOfTensorsGeneric
  from captum.attr._utils.attribution import Attribution, GradientAttribution
  from captum.attr._utils.common import _validate_noise_tunnel_type
  from captum.log import log_usage
  from torch import Tensor
label_desc: Use image node_id 1 to create a new NoiseTunnel object from inherited base classes: Attribution with example: obj = NoiseTunnel(attribution_method)