code: def _neuron_gradients(
      inputs: Union[Tensor, Tuple[Tensor, ...]],
      saved_layer: Dict[device, Tuple[Tensor, ...]],
      key_list: List[device],
      gradient_neuron_selector: Union[
          int, Tuple[Union[int, slice], ...], Callable
      ],
  ) -> Tuple[Tensor, ...]:
      with torch.autograd.set_grad_enabled(True):
          gradient_tensors = []
          for key in key_list:
              current_out_tensor = _verify_select_neuron(
                  saved_layer[key], gradient_neuron_selector
              )
              gradient_tensors.append(
                  torch.autograd.grad(
                      torch.unbind(current_out_tensor)
                      if current_out_tensor.numel() > 1
                      else current_out_tensor,
                      inputs,
                  )
              )
          _total_gradients = _reduce_list(gradient_tensors, sum)
      return _total_gradients
  
imports: import threading
  import typing
  import warnings
  from collections import defaultdict
  from typing import Any, Callable, cast, Dict, List, Optional, Sequence, Tuple, Union
  import torch
  from captum._utils.common import _reduce_list, _run_forward, _sort_key_list, _verify_select_neuron
  from captum._utils.sample_gradient import SampleGradientWrapper
  from captum._utils.typing import Literal, ModuleOrModuleList, TargetType, TensorOrTupleOfTensorsGeneric
  from torch import device, Tensor
  from torch.nn import Module
label_desc: Use image node_id 4 for calling a global function with example usage: _neuron_gradients(inputs, saved_layer, key_list, gradient_neuron_selector) and returns: _total_gradients