class_docstr: CoreML internal representation of a torch IR graph. A torch._C.Graph
  object is not an ideal structure to use in converting to CoreML. Conversion
  to an InternalTorchIRGraph is inserted between the original graph and the
  final CoreML model to address several issues:
      1. A torch._C.graph is hard to work with. For example, its .inputs()
        and .outputs() functions return iterators, so the only way to
        determine the number of inputs/outputs is by counting to the end.
        There are other examples of why the torch structure is hard to work
        with, and this structure alleviates those issues.
      2. torch._C.graph is an internal API and so we can't count on its
        stability. By inserting a layer in between, we can handle any changes
        to torch._C.graph here and isolate the ops code that processes the
        graph.
      3. torch._C.graph does not expose a Python constructor. This makes
        it impossible to write unit tests that isolate specific ops since
        they have to come from actually converting a PyTorch graph. With an
        internal structure, we can directly build the test cases we need for
        unit testing.
docstr: Arguments:
      torchscript: TorchScript object representing the model to convert.
      input_values: A list of inputs to the graph. Must be given is
          @raw_graph if not None.
      cut_at_symbols: The list of desired outputs from the graph. Symbols
          must be present in the graph. For debugging use only. Can only
          be given if @raw_graph is not None.
docstr_tok: ["Arguments",":","torchscript",":","TorchScript","object","representing","the","model","to","convert",".","input_values",":","A","list","of","inputs","to","the","graph",".","Must","be","given","is","@","raw_graph","if","not","None",".","cut_at_symbols",":","The","list","of","desired","outputs","from","the","graph",".","Symbols","must","be","present","in","the","graph",".","For","debugging","use","only",".","Can","only","be","given","if","@","raw_graph","is","not","None","."]
code: def from_torchscript(
      cls, torchscript, input_values=None, cut_at_symbols=None
  ):
      """
      Arguments:
          torchscript: TorchScript object representing the model to convert.
          input_values: A list of inputs to the graph. Must be given is
              @raw_graph if not None.
          cut_at_symbols: The list of desired outputs from the graph. Symbols
              must be present in the graph. For debugging use only. Can only
              be given if @raw_graph is not None.
      """
      if not isinstance(torchscript, torch.jit.ScriptModule):
          raise AssertionError(
              f"Input should be an object of type torch.jit.ScriptModule. Provide: {type(torchscript)}"
          )
  
      if hasattr(torchscript, "training") and torchscript.training:
          logger.warning(
              "Model is not in eval mode. "
              "Consider calling '.eval()' on your model prior to conversion"
          )
      if type(torchscript) == torch.jit._script.RecursiveScriptModule:
          logger.warning(
              "Support for converting Torch Script Models is experimental. "
              "If possible you should use a traced model for conversion."
          )
  
      nodes = []
      params = {}
      inputs = OrderedDict()
      outputs = []
  
      raw_graph, params_dict, buffer_dict = _expand_and_optimize_ir(
          torchscript
      )
  
      # Add params
      for name, param in params_dict.items():
          if isinstance(param, torch.Tensor):
              if param.is_quantized:
                  value = param
              else:
                  value = param.detach().cpu().numpy()
          else:
              value = param
          params[name] = value
  
      # Add inputs
      # The first element of the raw_graph.inputs() is the 'self' of the module, which is not used.
      graph_inputs = list(raw_graph.inputs())[1:]
      if len(graph_inputs) != len(input_values):
          raise ValueError(
              f"Number of TorchScript inputs ({len(graph_inputs)}) must match the user provided inputs ({len(input_values)})."
          )
      for index, _input in enumerate(graph_inputs):
          name = _input.debugName()
          value = input_values[index]
          inputs[name] = value
  
      # Add outputs, cutting if @cut_at_symbols is set
      output_names = cut_at_symbols
      if output_names is None:
          output_names = [x.debugName() for x in raw_graph.outputs()]
      for output in output_names:
          outputs.append(output)
  
      internal_graph = cls(
          nodes=nodes, params=params, inputs=inputs, outputs=outputs
      )
  
      node_names = set()
      # Add nodes
      for raw_node in raw_graph.nodes():
          new_node = InternalTorchIRNode.from_torchscript_node(
              node=raw_node, parent=internal_graph
          )
          if new_node.name == new_node.kind:
              new_node.name = _find_new_name(new_node.name, node_names)
          internal_graph.nodes.append(new_node)
          node_names.add(new_node.name)
  
      return internal_graph, params_dict, buffer_dict
  
imports: from collections import OrderedDict
  import torch
  from torch.fx.node import Node
  from coremltools import _logger
  from .edgeir_utils import extract_inputs_from_edge_program
  from .torchscript_utils import _expand_and_optimize_ir
label_desc: Use image node_id 2 for calling the InternalTorchIRGraph obj's underlying member method code with example usage: obj.from_torchscript(cls, torchscript, input_values, cut_at_symbols) and returns: internal_graph,  params_dict,  buffer_dict