code: def logits_to_prob(logits: np.ndarray):
      """
      Convert logits to probabilities.
  
      Parameters
      ----------
      logits
          The logits output of a classification head.
  
      Returns
      -------
      Probabilities.
      """
      if logits.ndim == 1:
          return expit(logits)
      elif logits.ndim == 2:
          return softmax(logits, axis=1)
      else:
          raise ValueError(f"Unsupported logit dim: {logits.ndim}.")
  
file_path: autogluon/multimodal/src/autogluon/multimodal/utils/misc.py
imports: import json
  import logging
  import os
  import re
  import numpy
  import pandas
  import torch
  from scipy.special import expit, softmax
label_desc: Use image node_id 1 for calling a global function with example usage: logits_to_prob(logits) and returns: expit, softmax