docstr: computes influence scores for a single training batch.
  `input_checkpoint_jacobians` is the output of
  `_basic_computation_tracincp` applied to the test batch, for each checkpoint,
  computed by `_get_checkpoint_jacobians`.
docstr_tok: ["computes","influence","scores","for","a","single","training","batch",".","`","input_checkpoint_jacobians","`","is","the","output","of","`","_basic_computation_tracincp","`","applied","to","the","test","batch",",","for","each","checkpoint",",","computed","by","`","_get_checkpoint_jacobians","`","."]
code: def _influence_batch_tracincp(
      self,
      input_checkpoint_jacobians: List[Tuple[Any, ...]],
      train_batch: Tuple[Any, ...],
  ) -> Tensor:
      """
      computes influence scores for a single training batch.
      `input_checkpoint_jacobians` is the output of
      `_basic_computation_tracincp` applied to the test batch, for each checkpoint,
      computed by `_get_checkpoint_jacobians`.
      """
  
      def get_checkpoint_contribution(input_jacobians, checkpoint):
          assert (
              checkpoint is not None
          ), "None returned from `checkpoints`, cannot load."
  
          learning_rate = self.checkpoints_load_func(
              self.model, checkpoint
          )
  
          return (
              _gradient_dot_product(
                  input_jacobians,
                  self._basic_computation_tracincp(
                      train_batch[0:-1],
                      train_batch[-1],
                      self.loss_fn,
                      self.reduction_type,
                  ),
              )
              * learning_rate
          )
  
      batch_tracin_scores = get_checkpoint_contribution(
          input_checkpoint_jacobians[0], self.checkpoints[0]
      )
  
      for input_jacobians, checkpoint in zip(
          input_checkpoint_jacobians[1:], self.checkpoints[1:]
      ):
          batch_tracin_scores += get_checkpoint_contribution(
              input_jacobians, checkpoint
          )
  
      return batch_tracin_scores
  
imports: import glob
  import warnings
  from abc import abstractmethod
  from os.path import join
  from typing import Any, Callable, Iterator, List, Optional, Tuple, Type, Union
  import torch
  from captum._utils.av import AV
  from captum._utils.common import _parse_version
  from captum._utils.progress import NullProgress, progress
  from captum.influence._core.influence import DataInfluence
  from captum.influence._utils.common import _check_loss_fn, _compute_jacobian_sample_wise_grads_per_batch, _format_inputs_dataset, _get_k_most_influential_helper, _gradient_dot_product, _influence_route_to_helpers, _load_flexible_state_dict, _self_influence_by_batches_helper, _set_active_parameters, KMostInfluentialResults
  from captum.log import log_usage
  from torch import Tensor
  from torch.nn import Module
  from torch.utils.data import DataLoader, Dataset
label_desc: Use image node_id 6 for calling the TracInCP obj's underlying member method code with example usage: obj._influence_batch_tracincp(input_checkpoint_jacobians, train_batch) and returns: batch_tracin_scores, unknown