code: def construct_feature_mask(feature_mask, formatted_inputs):
      if feature_mask is None:
          (
              feature_mask,
              num_interp_features,
          ) = _construct_default_feature_mask(formatted_inputs)
      else:
          feature_mask = _format_tensor_into_tuples(feature_mask)
          min_interp_features = int(
              min(
                  torch.min(single_mask).item()
                  for single_mask in feature_mask
                  if single_mask.numel()
              )
          )
          if min_interp_features != 0:
              warnings.warn(
                  "Minimum element in feature mask is not 0, shifting indices to"
                  " start at 0."
              )
              feature_mask = tuple(
                  single_mask - min_interp_features
                  for single_mask in feature_mask
              )
  
          num_interp_features = _get_max_feature_index(feature_mask) + 1
      return feature_mask, num_interp_features
  
imports: import inspect
  import math
  import typing
  import warnings
  from typing import Any, Callable, cast, List, Optional, Tuple, Union
  import torch
  from captum._utils.common import _expand_additional_forward_args, _expand_target, _flatten_tensor_or_tuple, _format_output, _format_tensor_into_tuples, _get_max_feature_index, _is_tuple, _reduce_list, _run_forward
  from captum._utils.models.linear_model import SkLearnLasso
  from captum._utils.models.model import Model
  from captum._utils.progress import progress
  from captum._utils.typing import BaselineType, Literal, TargetType, TensorOrTupleOfTensorsGeneric
  from captum.attr._utils.attribution import PerturbationAttribution
  from captum.attr._utils.batching import _batch_example_iterator
  from captum.attr._utils.common import _construct_default_feature_mask, _format_input_baseline
  from captum.log import log_usage
  from torch import Tensor
  from torch.nn import CosineSimilarity
  from torch.utils.data import DataLoader, TensorDataset
label_desc: Use image node_id 4 for calling a global function with example usage: construct_feature_mask(feature_mask, formatted_inputs) and returns: feature_mask,  num_interp_features