code: def get_max_updates(
      config_max_updates, config_max_epochs, train_loader, update_freq
  ):
      if config_max_updates is None and config_max_epochs is None:
          raise ValueError(
              "Neither max_updates nor max_epochs is specified."
          )
  
      if isinstance(
          train_loader.current_dataset, torch.utils.data.IterableDataset
      ):
          warnings.warn(
              "max_epochs not supported for Iterable datasets. Falling back "
              + "to max_updates."
          )
          return config_max_updates, config_max_epochs
  
      if (
          config_max_updates is not None
          and config_max_epochs is not None
      ):
          warnings.warn(
              "Both max_updates and max_epochs are specified. "
              + f"Favoring max_epochs: {config_max_epochs}"
          )
  
      if config_max_epochs is not None:
          assert (
              hasattr(train_loader, "__len__")
              and len(train_loader) != 0
          ), "max_epochs can't be used with IterableDatasets"
          max_updates = (
              math.ceil(len(train_loader) / update_freq)
              * config_max_epochs
          )
          max_epochs = config_max_epochs
      else:
          max_updates = config_max_updates
          if (
              hasattr(train_loader, "__len__")
              and len(train_loader) != 0
          ):
              max_epochs = max_updates / len(train_loader)
          else:
              max_epochs = math.inf
  
      return max_updates, max_epochs
  
imports: import collections
  import gc
  import logging
  import math
  import os
  import sys
  import time
  import warnings
  from bisect import bisect
  from typing import Any, Callable, Dict
  import torch
  from mmf.utils.distributed import get_rank, get_world_size, is_xla
  from mmf.utils.file_io import PathManager
  from packaging import version
  from torch import nn, Tensor
label_desc: Use image node_id 20 for calling a global function with example usage: get_max_updates(config_max_updates, config_max_epochs, train_loader, update_freq) and returns: max_updates,  max_epochs, config_max_updates,  config_max_epochs