code: def _get_output_spec(model: LudwigModel) -> List[Dict[str, Any]]:
      from cartonml import TensorSpec
  
      spec = []
      for feature_name, feature in model.model.output_features.items():
          metadata = model.training_set_metadata[feature_name]
          spec.append(
              TensorSpec(
                  name=feature.feature_name,
                  dtype=feature.get_postproc_output_dtype(metadata),
                  shape=("batch_size",),
              )
          )
      return spec
  
file_path: ludwig/ludwig/utils/carton_utils.py
imports: import asyncio
  import importlib.util
  import logging
  import os
  import shutil
  import tempfile
  from typing import Any, Dict, List
  import torch
  from ludwig.api import LudwigModel
  from ludwig.api_annotations import DeveloperAPI
  from ludwig.constants import NAME
  from ludwig.types import ModelConfigDict
  from ludwig.utils.fs_utils import open_file
label_desc: Use image node_id 4 for calling a global function with example usage: _get_output_spec(model) and returns: spec