code: def promote_current_grad_sample(p: nn.Parameter) -> None:
      if p.requires_grad:
          if p.grad_sample is not None:
              if isinstance(p.grad_sample, list):
                  p.grad_sample.append(p._current_grad_sample)
              else:
                  p.grad_sample = [
                      p.grad_sample,
                      p._current_grad_sample,
                  ]
          else:
              p.grad_sample = p._current_grad_sample
  
          del p._current_grad_sample
  
imports: from __future__ import annotations
  import logging
  import warnings
  from functools import partial
  from typing import Iterable, List, Tuple
  import torch
  import torch.nn
  from opacus.grad_sample.functorch import ft_compute_per_sample_gradient, prepare_layer
  from opacus.grad_sample.gsm_base import AbstractGradSampleModule
  from opacus.layers.dp_rnn import DPGRU, DPLSTM, DPRNN, RNNLinear
  from opacus.utils.module_utils import has_trainable_params, requires_grad, trainable_modules, trainable_parameters
label_desc: Use image node_id 2 for calling a global function with example usage: promote_current_grad_sample(p) without return types