code: def _expand_additional_forward_args(
      additional_forward_args: Any,
      n_steps: int,
      expansion_type: ExpansionTypes = ExpansionTypes.repeat,
  ) -> Union[None, Tuple]:
      def _expand_tensor_forward_arg(
          additional_forward_arg: Tensor,
          n_steps: int,
          expansion_type: ExpansionTypes = ExpansionTypes.repeat,
      ) -> Tensor:
          if len(additional_forward_arg.size()) == 0:
              return additional_forward_arg
          if expansion_type == ExpansionTypes.repeat:
              return torch.cat(
                  [additional_forward_arg] * n_steps, dim=0
              )
          elif expansion_type == ExpansionTypes.repeat_interleave:
              return additional_forward_arg.repeat_interleave(
                  n_steps, dim=0
              )
          else:
              raise NotImplementedError(
                  "Currently only `repeat` and `repeat_interleave`"
                  " expansion_types are supported"
              )
  
      if additional_forward_args is None:
          return None
  
      return tuple(
          _expand_tensor_forward_arg(
              additional_forward_arg, n_steps, expansion_type
          )
          if isinstance(additional_forward_arg, torch.Tensor)
          else additional_forward_arg
          for additional_forward_arg in additional_forward_args
      )
  
imports: import typing
  from enum import Enum
  from functools import reduce
  from inspect import signature
  from typing import Any, Callable, cast, Dict, List, overload, Tuple, Union
  import numpy
  import torch
  from captum._utils.typing import BaselineType, Literal, TargetType, TensorOrTupleOfTensorsGeneric, TupleOrTensorOrBoolGeneric
  from torch import device, Tensor
  from torch.nn import Module
label_desc: Use image node_id 21 for calling a global function with example usage: _expand_additional_forward_args(additional_forward_args, n_steps, expansion_type) and returns: tuple, None, additional_forward_arg, torch, additional_forward_arg