code: def _adjust_main_outputs(func):
      """Adjust the outputs in the main func to make sure they have Core ML I/O supported types."""
      _IO_SUPPORTED_TYPES = _get_io_supported_types(func.opset_version)
  
      new_outputs = []
      for output_var in func.outputs:
          output_type = output_var.sym_type
          if (
              types.is_tensor(output_type)
              or types.is_scalar(output_type)
          ) and output_var.dtype not in _IO_SUPPORTED_TYPES:
              output_dtype_str = types.builtin_to_string(
                  output_var.dtype
              )
              target_dtype = (
                  "int32" if types.is_int(output_var.dtype) else "fp32"
              )
              logger.warning(
                  f"\nOutput '{output_var.name}' is of dtype {output_dtype_str}. The "
                  f"Core ML runtime does not support outputs with this dtype (supported "
                  f"dtypes are: {_IO_SUPPORTED_TYPES}). This output will changed to "
                  f"{target_dtype} by adding a cast op at the end of the program.\n"
              )
              if output_var.dtype == types.fp16:
                  logger.warning(
                      "fp16 dtype output is supported if function.opset_version is chosen to be at "
                      "least iOS16/macOS13.\n"
                  )
  
              output_var_name = output_var.name
              output_var.set_name(
                  f"{output_var_name}__pre__output__{target_dtype}__cast"
              )
              output_var = mb.cast(x=output_var, dtype=target_dtype)
              output_var.set_name(output_var_name)
          new_outputs.append(output_var)
      func.set_outputs(new_outputs)
  
file_path: coremltools/coremltools/converters/mil/backend/mil/passes/adjust_io_to_supported_types.py
imports: from typing import Set
  from coremltools import _logger
  from coremltools.converters.mil._deployment_compatibility import AvailableTarget
  from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil.mil import types
  from coremltools.converters.mil.mil.passes.graph_pass import AbstractGraphPass
  from coremltools.converters.mil.mil.passes.helper import block_context_manager
  from coremltools.converters.mil.mil.passes.pass_registry import register_pass
label_desc: Use image node_id 5 for calling a global function with example usage: _adjust_main_outputs(func) without return types