class_docstr: A perturbation based approach to computing neuron attribution,
  involving replacing each input feature with a given baseline /
  reference, and computing the difference in the neuron's input / output.
  By default, each scalar value within
  each input tensor is taken as a feature and replaced independently. Passing
  a feature mask, allows grouping features to be ablated together. This can
  be used in cases such as images, where an entire segment or region
  can be ablated, measuring the importance of the segment (feature group).
  Each input scalar in the group will be given the same attribution value
  equal to the change in target as a result of ablating the entire feature
  group.
docstr: Args:
  
      forward_func (Callable): The forward function of the model or any
                    modification of it
      layer (torch.nn.Module): Layer for which attributions are computed.
                    Attributions for a particular neuron in the input or output
                    of this layer are computed using the argument neuron_selector
                    in the attribute method.
                    Currently, it is assumed that the inputs or the outputs
                    of the layer, depending on which one is used for
                    attribution, can only be a single tensor.
      device_ids (list[int]): Device ID list, necessary only if forward_func
                    applies a DataParallel model. This allows reconstruction of
                    intermediate outputs from batched results across devices.
                    If forward_func is given as the DataParallel model itself,
                    then it is not necessary to provide this argument.
docstr_tok: ["Args",":","forward_func","(","Callable",")",":","The","forward","function","of","the","model","or","any","modification","of","it","layer","(","torch.nn.Module",")",":","Layer","for","which","attributions","are","computed",".","Attributions","for","a","particular","neuron","in","the","input","or","output","of","this","layer","are","computed","using","the","argument","neuron_selector","in","the","attribute","method",".","Currently",",","it","is","assumed","that","the","inputs","or","the","outputs","of","the","layer",",","depending","on","which","one","is","used","for","attribution",",","can","only","be","a","single","tensor",".","device_ids","(","list","[","int","]",")",":","Device","ID","list",",","necessary","only","if","forward_func","applies","a","DataParallel","model",".","This","allows","reconstruction","of","intermediate","outputs","from","batched","results","across","devices",".","If","forward_func","is","given","as","the","DataParallel","model","itself",",","then","it","is","not","necessary","to","provide","this","argument","."]
code: def __init__(
      self,
      forward_func: Callable,
      layer: Module,
      device_ids: Union[None, List[int]] = None,
  ) -> None:
      r"""
      Args:
  
          forward_func (Callable): The forward function of the model or any
                        modification of it
          layer (torch.nn.Module): Layer for which attributions are computed.
                        Attributions for a particular neuron in the input or output
                        of this layer are computed using the argument neuron_selector
                        in the attribute method.
                        Currently, it is assumed that the inputs or the outputs
                        of the layer, depending on which one is used for
                        attribution, can only be a single tensor.
          device_ids (list[int]): Device ID list, necessary only if forward_func
                        applies a DataParallel model. This allows reconstruction of
                        intermediate outputs from batched results across devices.
                        If forward_func is given as the DataParallel model itself,
                        then it is not necessary to provide this argument.
      """
      NeuronAttribution.__init__(self, forward_func, layer, device_ids)
      PerturbationAttribution.__init__(self, forward_func)
  
file_path: captum/captum/attr/_core/neuron/neuron_feature_ablation.py
imports: from typing import Any, Callable, List, Tuple, Union
  import torch
  from captum._utils.common import _verify_select_neuron
  from captum._utils.gradient import _forward_layer_eval
  from captum._utils.typing import BaselineType, TensorOrTupleOfTensorsGeneric
  from captum.attr._core.feature_ablation import FeatureAblation
  from captum.attr._utils.attribution import NeuronAttribution, PerturbationAttribution
  from captum.log import log_usage
  from torch.nn import Module
label_desc: Use image node_id 1 to create a new NeuronFeatureAblation object from inherited base classes: NeuronAttribution, PerturbationAttribution with example: obj = NeuronFeatureAblation(forward_func, layer, device_ids)