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
docstr: Arguments:
      loaded_model: It could be one of the following:
              - In-memory TorchScript model of type torch.jit.ScriptModule
              - In-memory EdgeIR program of type ExportedProgram
      inputs: Input values and optional names. See kwarg in load.py for full description.
      outputs: List of outputs as ct.InputType. See kwarg in load.py for full description.
      cut_at_symbols: A list of internal symbol name strings. Graph conversion will
          terminate once these symbols have been generated. For debugging use
          only. See kwarg in load.py.
      opset_version: An int represents the Core ML opset version.
      use_default_fp16_io (optional): bool. Defaults to False.
          When minimum_deployment_target set >= ct.target.iOS16 (the same as ct.target.macOS13),
          and the compute precision set to fp16, this flag is True.
          When True, fp32 i/o defaults to fp16.
docstr_tok: ["Arguments",":","loaded_model",":","It","could","be","one","of","the","following",":","-","In-memory","TorchScript","model","of","type","torch.jit.ScriptModule","-","In-memory","EdgeIR","program","of","type","ExportedProgram","inputs",":","Input","values","and","optional","names",".","See","kwarg","in","load.py","for","full","description",".","outputs",":","List","of","outputs","as","ct.InputType",".","See","kwarg","in","load.py","for","full","description",".","cut_at_symbols",":","A","list","of","internal","symbol","name","strings",".","Graph","conversion","will","terminate","once","these","symbols","have","been","generated",".","For","debugging","use","only",".","See","kwarg","in","load.py",".","opset_version",":","An","int","represents","the","Core","ML","opset","version",".","use_default_fp16_io","(","optional",")",":","bool",".","Defaults","to","False",".","When","minimum_deployment_target","set",">","=","ct.target.iOS16","(","the","same","as","ct.target.macOS13",")",",","and","the","compute","precision","set","to","fp16",",","this","flag","is","True",".","When","True",",","fp32","i\/o","defaults","to","fp16","."]
code: def __init__(
      self,
      loaded_model: Union[RecursiveScriptModule, "ExportedProgram"],
      inputs: Optional[List[TensorType]] = None,
      outputs: Optional[List[TensorType]] = None,
      cut_at_symbols: Optional[List[str]] = None,
      opset_version: Optional[int] = None,
      use_default_fp16_io: bool = False,
  ) -> None:
      """
      Arguments:
          loaded_model: It could be one of the following:
                  - In-memory TorchScript model of type torch.jit.ScriptModule
                  - In-memory EdgeIR program of type ExportedProgram
          inputs: Input values and optional names. See kwarg in load.py for full description.
          outputs: List of outputs as ct.InputType. See kwarg in load.py for full description.
          cut_at_symbols: A list of internal symbol name strings. Graph conversion will
              terminate once these symbols have been generated. For debugging use
              only. See kwarg in load.py.
          opset_version: An int represents the Core ML opset version.
          use_default_fp16_io (optional): bool. Defaults to False.
              When minimum_deployment_target set >= ct.target.iOS16 (the same as ct.target.macOS13),
              and the compute precision set to fp16, this flag is True.
              When True, fp32 i/o defaults to fp16.
      """
      self.use_default_fp16_io = use_default_fp16_io
  
      if inputs is not None:
          inputs = _convert_to_torch_inputtype(inputs)
          self.inputs = inputs
          for idx, inp in enumerate(self.inputs):
              if (
                  isinstance(inp, ImageType)
                  and self.inputs[idx].channel_first is None
              ):
                  self.inputs[idx].channel_first = True
  
          if self.use_default_fp16_io:
              # If the input type is not specified by the user and use_default_fp16_io
              # is True. Make the default input type to fp16
              self._adjust_default_input_to_fp16()
  
      self.outputs = outputs
      self.output_names = get_output_names(self.outputs)
      self.opset_version = (
          _target(opset_version) if opset_version is not None else None
      )
      self.context = TranscriptionContext()
      self._prog = Program()
  
      if isinstance(loaded_model, torch.jit.ScriptModule):
          self.context.frontend = TorchFrontend.TORCHSCRIPT
          (
              self.graph,
              self.params_dict,
              self.buffer_dict,
          ) = InternalTorchIRGraph.from_torchscript(
              torchscript=loaded_model,
              input_values=self.inputs,
              cut_at_symbols=cut_at_symbols,
          )
  
          # TODO (rdar://106161395): Register Torch IR passes and unify them into the pass pipeline.
          # Apply Torch IR passes
          passes = [
              transform_inplace_ops,
              flatten_graph_input_values,
              flatten_graph_output_values,
              remove_getattr_nodes,
              generate_tensor_assignment_ops,
          ]
          for p in passes:
              p(self.graph)
  
      elif _HAS_TORCH_EXPORT_API and isinstance(
          loaded_model, ExportedProgram
      ):
          self.context.frontend = TorchFrontend.EDGEIR
          self.graph = InternalTorchIRGraph.from_edgeir(
              edgeir=loaded_model
          )
          self.params_dict, self.buffer_dict = None, None
      else:
          raise ValueError(
              "Model should be an instance of either torch.jit.ScriptModule or ExportedProgram"
          )
  
      self.context.torch_graph = self.graph
  
      self.inputs = list(self.graph.inputs.values())
  
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 1 to create a new TorchConverter object  with example: obj = TorchConverter(loaded_model, inputs, outputs, cut_at_symbols, opset_version, use_default_fp16_io)