code: def _parameter_distill(
      qs: List[Tuple[Tensor, ...]],
      H: Tensor,
      k: Optional[int],
      hessian_reg: float,
      hessian_inverse_tol: float,
  ):
      """
      This takes the output of `_parameter_arnoldi`, and extracts the top-k eigenvalues
      / eigenvectors of the matrix that `_parameter_arnoldi` found the Krylov subspace
      for. In this documentation, we will refer to that matrix by `A`.
  
      Args:
          qs (list of tuple of tensors): A list of tuple of tensors, whose first `N`
                  elements contain a basis for the Krylov subspace.
          H (tensor): A tensor with shape `(N+1, N)` whose first `N` rows represent
                  the restriction of `A` to the Krylov subspace.
          k (int): The number of top eigenvalues / eigenvectors to return. Note that the
                  actual number returned may be less, due to filtering based on
                  `hessian_inverse_tol`.
          hessian_reg (float): hessian_reg (float): We add an entry to the diagonal of
                  `H` to encourage it to be positive definite. This is that entry.
          hessian_inverse_tol (float): To compute the "square root" of `H` using the top
                  eigenvectors / eigenvalues, the eigenvalues should be positive, and
                  furthermore if above a tolerance, the inversion will be more
                  numerically stable. Therefore, we only return eigenvectors /
                  eigenvalues where the eigenvalue is above a tolerance. This argument
                  specifies that tolerance. We do not compute the square root in this
                  function, but assume the output of this function will be used for
                  computing it, hence the need for this argument.
  
      Returns:
          (eigenvalues, eigenvectors) (tensor, list of tuple of tensors): `eigenvalues`
                  is a 1D tensor of the top eigenvalues of `A`. Note that due to
                  filtering based on `hessian_inverse_tol`, the actual number of
                  eigenvalues may be less than `k`. The eigenvalues are in ascending
                  order, mimicking the convention of `torch.linalg.eigh`. `eigenvectors`
                  are the corresponding eigenvectors. Since `A` represents the Hessian
                  of parameters, with the parameters represented as a tuple of tensors,
                  the eigenvectors, because they represent parameters, are also
                  tuples of tensors. Therefore, `eigenvectors` is a list of tuple of
                  tensors.
      """
      # get rid of last basis of qs, last column of H, since they are not part of
      # the decomposition
      qs = qs[:-1]
      H = H[:-1]
  
      # if arnoldi basis is empty, raise exception
      if len(qs) == 0:
          raise Exception(
              "Arnoldi basis is empty. Consider increasing the `arnoldi_tol` argument"
          )
  
      # ls, vs are the top eigenvalues / eigenvectors.  however, the eigenvectors are
      # expressed as coordinates using the Krylov subspace basis, qs (each column of vs
      # represents a different eigenvector).
      ls, vs = _top_eigen(H, k, hessian_reg, hessian_inverse_tol)
  
      # if no positive eigenvalues exist, we cannot compute a low-rank
      # approximation of the square root of the hessian H, so raise exception
      if vs.shape[1] == 0:
          raise Exception(
              "Restriction of Hessian to Krylov subspace has no positive "
              "eigenvalues, so cannot take its square root."
          )
  
      # we want to express the top eigenvectors as coordinates using the standard basis.
      # each column of vs represents a different eigenvector, expressed as coordinates
      # using the Krylov subspace basis.  to express the eigenvector using the standard
      # basis, we use it as the coefficients in a linear combination with the Krylov
      # subspace basis, qs.
      vs_standard = [_parameter_linear_combination(qs, v) for v in vs.T]
  
      return ls, vs_standard
  
imports: import functools
  from typing import Any, Callable, List, Optional, Tuple, Union
  import torch
  from captum._utils.gradient import _extract_parameters_from_layers
  from captum.influence._utils.common import _compute_batch_loss_influence_function_base, _compute_jacobian_sample_wise_grads_per_batch, _dataset_fn, _format_inputs_dataset, _functional_call, _get_k_most_influential_helper, _influence_batch_intermediate_quantities_influence_function, _influence_helper_intermediate_quantities_influence_function, _influence_route_to_helpers, _load_flexible_state_dict, _parameter_add, _parameter_dot, _parameter_linear_combination, _parameter_multiply, _parameter_to, _params_to_names, _progress_bar_constructor, _self_influence_helper_intermediate_quantities_influence_function, _top_eigen, KMostInfluentialResults
  from captum.log import log_usage
  from torch import Tensor
  from torch.nn import Module
  from torch.utils.data import DataLoader, Dataset
  from tqdm import tqdm
  from .influence_function import _get_dataset_embeddings_intermediate_quantities_influence_function, InfluenceFunctionBase, IntermediateQuantitiesInfluenceFunction
label_desc: Use image node_id 2 for calling a global function with example usage: _parameter_distill(qs, H, k, hessian_reg, hessian_inverse_tol) and returns: ls,  vs_standard