class_docstr: A perturbation based approach to computing layer attribution, involving
  replacing values in the input / output of a layer with a given baseline /
  reference, and computing the difference in output. By default, each
  neuron (scalar input / output value) within the layer is replaced
  independently.
  Passing a layer mask allows grouping neurons to be
  ablated together.
  Each neuron in the group will be given the same attribution value
  equal to the change in target as a result of ablating the entire neuron
  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.
                    Output size of attribute matches this layer's input or
                    output dimensions, depending on whether we attribute to
                    the inputs or outputs of the layer, corresponding to
                    attribution of each neuron in the input or output of
                    this layer.
      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
                    (or otherwise has a device_ids attribute with the device
                    ID list), 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",".","Output","size","of","attribute","matches","this","layer","'s","input","or","output","dimensions",",","depending","on","whether","we","attribute","to","the","inputs","or","outputs","of","the","layer",",","corresponding","to","attribution","of","each","neuron","in","the","input","or","output","of","this","layer",".","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","(","or","otherwise","has","a","device_ids","attribute","with","the","device","ID","list",")",",","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.
                        Output size of attribute matches this layer's input or
                        output dimensions, depending on whether we attribute to
                        the inputs or outputs of the layer, corresponding to
                        attribution of each neuron in the input or output of
                        this layer.
          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
                        (or otherwise has a device_ids attribute with the device
                        ID list), then it is not necessary to provide this
                        argument.
      """
      LayerAttribution.__init__(self, forward_func, layer, device_ids)
      PerturbationAttribution.__init__(self, forward_func)
  
file_path: captum/captum/attr/_core/layer/layer_feature_ablation.py
imports: from typing import Any, Callable, List, Tuple, Union
  import torch
  from captum._utils.common import _extract_device, _format_additional_forward_args, _format_output, _format_tensor_into_tuples, _run_forward
  from captum._utils.gradient import _forward_layer_eval
  from captum._utils.typing import BaselineType, TargetType
  from captum.attr._core.feature_ablation import FeatureAblation
  from captum.attr._utils.attribution import LayerAttribution, PerturbationAttribution
  from captum.log import log_usage
  from torch import Tensor
  from torch.nn import Module
  from torch.nn.parallel.scatter_gather import scatter
label_desc: Use image node_id 1 to create a new LayerFeatureAblation object from inherited base classes: LayerAttribution, PerturbationAttribution with example: obj = LayerFeatureAblation(forward_func, layer, device_ids)