class_docstr: Computes the gradient of the output of a particular neuron with
  respect to the inputs of the network.
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.
                    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.
                        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.
                        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)
      GradientAttribution.__init__(self, forward_func)
  
file_path: captum/captum/attr/_core/neuron/neuron_gradient.py
imports: from typing import Any, Callable, List, Tuple, Union
  from captum._utils.common import _format_additional_forward_args, _format_output, _format_tensor_into_tuples, _is_tuple
  from captum._utils.gradient import _forward_layer_eval_with_neuron_grads, apply_gradient_requirements, undo_gradient_requirements
  from captum._utils.typing import TensorOrTupleOfTensorsGeneric
  from captum.attr._utils.attribution import GradientAttribution, NeuronAttribution
  from captum.log import log_usage
  from torch.nn import Module
label_desc: Use image node_id 1 to create a new NeuronGradient object from inherited base classes: NeuronAttribution, GradientAttribution with example: obj = NeuronGradient(forward_func, layer, device_ids)