class_docstr: Class that handles conversion of pytorch models to the MIL format.
  
  Models passed to the @TorchConverter go from:
  Loaded-Torch Model -> Internal Graph -> PyMIL
code: def convert(self) -> Program:
      logger.info("Converting graph.")
  
      # Set SSA function input name to user defined name if provided.
      for index, (name, spec) in enumerate(self.graph.inputs.items()):
          if spec.name is not None:
              name = spec.name
          self.inputs[index].name = name
  
      # This will hold the converted model.
      prog = self._prog
      prog.set_main_input_types(tuple(self.inputs))
  
      # Construct placeholder for input to SSA function
      ssa_func_inputs = OrderedDict()
      for spec in self.inputs:
          ssa_func_inputs[spec.name] = self._create_placeholder(spec)
  
      # Initialize the SSA for conversion
      with Function(
          ssa_func_inputs, opset_version=self.opset_version
      ) as ssa_func:
          # Map internal @self.graph.inputs to user specified @ssa_func_inputs
          # If @self.graph.inputs == @ssa_func_inputs this just adds the inputs
          # to the context.
          # Convert input placeholders
          user_names = list(ssa_func_inputs.keys())
          internal_names = list(self.graph.inputs.keys())
          internal_names.extend(user_names[len(internal_names) :])
          for torch_name, ssa_name in zip(internal_names, user_names):
              input_var = self._preprocess_input_vars(
                  ssa_func.inputs[ssa_name]
              )
              self.context.add(input_var, torch_name=torch_name)
  
          # Convert constants
          self.convert_const()
  
          # Add the rest of the operations
          convert_nodes(self.context, self.graph)
  
          graph_outputs = [
              self.context[name] for name in self.graph.outputs
          ]
  
          # An output can be None when it's a None constant, which happens
          # in Fairseq MT.
          for g in graph_outputs:
              if g is None:
                  logger.warning(f"Dropping output {g} which is None")
          graph_outputs = [g for g in graph_outputs if g is not None]
  
          # Output renaming occurs
          if self.outputs is not None:
              if len(self.outputs) != len(graph_outputs):
                  raise ValueError(
                      f"Number of outputs provided, {len(self.outputs)}, do not match the number of outputs detected in the model, {len(graph_outputs)}."
                  )
          if self.output_names:
              for index, var in enumerate(graph_outputs):
                  if self.output_names[index] is not None:
                      output_rename = self.output_names[index]
                      var.name = output_rename
  
          ssa_func.set_outputs(graph_outputs)
          prog.add_function("main", ssa_func)
          if self.use_default_fp16_io:
              # If the output type is not specified by the user and use_default_fp16_io
              # is True. Make the default output type to fp16
              self._adjust_default_output_to_fp16(graph_outputs)
          if self.outputs is not None:
              prog.set_main_output_types(self.outputs)
      return prog
  
imports: from collections import OrderedDict
  from typing import List, Optional, Union
  import numpy
  import torch
  from torch.jit._script import RecursiveScriptModule
  from coremltools import _logger
  from coremltools._deps import _HAS_TORCH_EXPORT_API
  from coremltools.converters.mil._deployment_compatibility import AvailableTarget
  from coremltools.converters.mil.input_types import ImageType, InputType, TensorType
  from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil.mil import Function, Placeholder, Program, types
  from coremltools.converters.mil.mil.types import is_float
  from coremltools.converters.mil.mil.var import Var
  from .._utils import get_output_names
  from .internal_graph import InternalTorchIRGraph, InternalTorchIRNode
  from .ops import TorchFrontend, convert_nodes
  from .quantization_ops import _dequantized_weight
  from .torch_op_registry import _TORCH_OPS_REGISTRY
  from .torchir_passes import flatten_graph_input_values, flatten_graph_output_values, generate_tensor_assignment_ops, remove_getattr_nodes, transform_inplace_ops
  from .torchscript_utils import torch_to_mil_types
label_desc: Use image node_id 9 for calling the TorchConverter obj's underlying member method code with example usage: obj.convert() and returns: prog