code: def _shape_feature_mask(
      feature_mask: Tuple[Tensor, ...], inputs: Tuple[Tensor, ...]
  ) -> Tuple[Tensor, ...]:
      """
      ensure feature_mask has the same number of dims as the inputs
      i.e., prepend dummy dims of 1 to the masks that broadcastable to inputs
      """
      mask_list = []
      for i, (mask, inp) in enumerate(zip(feature_mask, inputs)):
          assert _is_mask_valid(mask, inp), (
              f"the shape of feature mask (index {i}) is invalid,"
              f"input shape: {inp.shape}, feature mask shape {mask.shape}"
          )
          if mask.dim() < inp.dim():
              mask = mask.reshape(
                  (1,) * (inp.dim() - mask.dim()) + mask.shape
              )
  
          mask_list.append(mask)
  
      return tuple(mask_list)
  
imports: import itertools
  import math
  import warnings
  from typing import Any, Callable, Iterable, Sequence, Tuple, Union
  import torch
  from captum._utils.common import _expand_additional_forward_args, _expand_target, _format_additional_forward_args, _format_feature_mask, _format_output, _format_tensor_into_tuples, _get_max_feature_index, _is_mask_valid, _is_tuple, _run_forward
  from captum._utils.progress import progress
  from captum._utils.typing import BaselineType, TargetType, TensorOrTupleOfTensorsGeneric
  from captum.attr._utils.attribution import PerturbationAttribution
  from captum.attr._utils.common import _find_output_mode_and_verify, _format_input_baseline, _tensorize_baseline
  from captum.log import log_usage
  from torch import Tensor
label_desc: Use image node_id 3 for calling a global function with example usage: _shape_feature_mask(feature_mask, inputs) and returns: tuple