code: def infer_output_shape(
      label_column: str,
      problem_type: str,
      data: pd.DataFrame,
  ) -> int:
      """
      Infer the output shape based on the label column type, training data, and problem type.
      Binary classification should have class number 2, while multi-class classification's class
      number should be larger than 2. For regression, the output is restricted to 1 scalar.
  
      Parameters
      ----------
      label_column
          The label column in a multimodal pd.DataFrame.
      data
          The multimodal pd.DataFrame for training.
      problem_type
          Problem type which can be inferred or provided.
  
      Returns
      -------
      problem_type
          Type of problem.
      output_shape
          Shape of output.
      """
      if label_column is None:
          return None
  
      if problem_type in [
          BINARY,
          MULTICLASS,
          REGRESSION,
          CLASSIFICATION,
      ]:
          class_num = len(data[label_column].unique())
          err_msg = (
              f"Problem type is '{problem_type}' while the number of "
              f"unique values in the label column is {class_num}."
          )
          if problem_type == BINARY:
              if class_num != 2:
                  raise AssertionError(err_msg)
              return 2
          elif problem_type == MULTICLASS:
              if class_num <= 2:
                  raise AssertionError(err_msg)
              return class_num
          elif problem_type == REGRESSION:
              if class_num < 1:
                  raise AssertionError(err_msg)
              return 1
          else:
              return class_num
      elif problem_type in [
          NER,
          OBJECT_DETECTION,
          OPEN_VOCABULARY_OBJECT_DETECTION,
          SEMANTIC_SEGMENTATION,
      ]:
          return None
      else:
          raise ValueError(
              f"Problem type '{problem_type}' doesn't have a valid output shape "
              f"for training. The supported problem types are"
              f" '{BINARY}', '{MULTICLASS}', '{REGRESSION}',"
              f" '{CLASSIFICATION}', '{NER}',"
              f" '{OBJECT_DETECTION}', '{OPEN_VOCABULARY_OBJECT_DETECTION}',"
              f" '{SEMANTIC_SEGMENTATION}"
          )
  
imports: import collections
  import json
  import logging
  import warnings
  from io import BytesIO
  from typing import Dict, List, Optional, Tuple, Union
  import pandas
  import PIL
  import pytesseract
  from autogluon.core.utils import infer_problem_type
  from ..constants import BINARY, CATEGORICAL, CLASSIFICATION, DOCUMENT_IMAGE, DOCUMENT_PDF, IDENTIFIER, IMAGE, IMAGE_BYTEARRAY, IMAGE_PATH, MULTICLASS, NER, NER_ANNOTATION, NULL, NUMERICAL, OBJECT_DETECTION, OPEN_VOCABULARY_OBJECT_DETECTION, REGRESSION, ROIS, SEMANTIC_SEGMENTATION, SEMANTIC_SEGMENTATION_GT, SEMANTIC_SEGMENTATION_IMG, TEXT, TEXT_NER
  from .utils import is_rois_input
label_desc: Use image node_id 15 for calling a global function with example usage: infer_output_shape(label_column, problem_type, data) and returns: None, int, None, class_num, int, class_num