code: def ohe_to_ord_shape(
      shape: tuple, cat_vars: Dict[int, int], is_ohe: bool = False
  ) -> tuple:
      """
      Infer shape of instance if the categorical variables have ordinal instead of one-hot encoding.
  
      Parameters
      ----------
      shape
          Instance shape, starting with batch dimension.
      cat_vars
          Dict with as keys the categorical columns and as values
          the number of categories per categorical variable.
      is_ohe
          Whether instance is OHE.
  
      Returns
      -------
      Tuple with shape of instance with ordinal encoding of categorical variables.
      """
      if not is_ohe:
          return shape
      else:
          n_cols_ohe = 0
          for _, v in cat_vars.items():
              n_cols_ohe += v - 1
          shape = (shape[0],) + (shape[-1] - n_cols_ohe,)
          return shape
  
imports: from typing import Dict, List, Tuple
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: ohe_to_ord_shape(shape, cat_vars, is_ohe) and returns: shape, shape