code: def flatten_graph_input_values(graph):
      """CoreML can't handle nested iterables of tensors, so we flatten the
      inputs of any graph that expects them.
      """
      new_graph_inputs = graph.inputs
      all_new_nodes = []
      changed = True
      notified = False
  
      while changed:
          old_graph_inputs = new_graph_inputs
          new_graph_inputs = OrderedDict()
          new_nodes = []
          changed = False
          for _input_name, _input_val in old_graph_inputs.items():
              if isinstance(_input_val, (tuple, list)):
                  changed = True
                  if not notified:
                      notified = True
                      _logging.warning(
                          "Tuple detected at graph input. This will be flattened in the converted model."
                      )
                  # If this input to the graph is a tuple, we want to replace it
                  # with a flattened version and add an op to construct the tuple.
                  node_inputs = []
                  for idx, item in enumerate(_input_val):
                      name = _input_name + "_{}".format(idx)
                      new_graph_inputs[name] = item
                      node_inputs.append(name)
                  new_nodes.append(
                      InternalTorchIRNode(
                          inputs=node_inputs,
                          outputs=[_input_name],
                          kind="tupleconstruct",
                      )
                  )
              else:
                  # This input isn't a tuple, keep it as is.
                  new_graph_inputs[_input_name] = _input_val
          all_new_nodes = new_nodes + all_new_nodes
      graph.inputs = new_graph_inputs
      graph.nodes = all_new_nodes + graph.nodes
  
imports: from collections import OrderedDict
  import logging
  from .internal_graph import *
label_desc: Use image node_id 2 for calling a global function with example usage: flatten_graph_input_values(graph) without return types