code: def _influence_helper_intermediate_quantities_influence_function(
      influence_inst: "IntermediateQuantitiesInfluenceFunction",
      inputs_dataset: Union[Tuple[Any, ...], DataLoader],
      show_progress: bool,
  ):
      """
      Helper function that computes influence scores for implementations of
      `NaiveInfluenceFunction` which implement the `compute_intermediate_quantities`
      method returning "embedding" vectors, so that the influence score of one example
      on another is the dot-product of their vectors.
      """
      # If `inputs_dataset` is not a `DataLoader`, turn it into one.
      inputs_dataset = _format_inputs_dataset(inputs_dataset)
  
      inputs_intermediate_quantities = (
          influence_inst.compute_intermediate_quantities(
              inputs_dataset,
              show_progress=show_progress,
              test=True,
          )
      )
  
      train_dataloader = influence_inst.train_dataloader
      if show_progress:
          train_dataloader = _progress_bar_constructor(
              influence_inst,
              train_dataloader,
              "train_dataset",
              "influence scores",
          )
  
      return torch.cat(
          [
              torch.matmul(
                  inputs_intermediate_quantities,
                  influence_inst.compute_intermediate_quantities(
                      batch
                  ).T,
              )
              for batch in train_dataloader
          ],
          dim=1,
      )
  
imports: import warnings
  from functools import reduce
  from typing import Any, Callable, Iterable, List, NamedTuple, Optional, Tuple, TYPE_CHECKING, Union
  import torch
  import torch.nn
  from captum._utils.common import _get_module_from_name, _parse_version
  from captum._utils.gradient import _compute_jacobian_wrt_params, _compute_jacobian_wrt_params_with_sample_wise_trick
  from captum._utils.progress import progress
  from torch import Tensor
  from torch.nn import Module
  from torch.utils.data import DataLoader, Dataset
label_desc: Use image node_id 15 for calling a global function with example usage: _influence_helper_intermediate_quantities_influence_function(influence_inst, inputs_dataset, show_progress) and returns: torch