code: def _convert_past_list_to_tuple(past_key_values):
      """
      In Bart model, the type of past_key_values is tuple(tuple(torch.FloatTensor)) which is not
      TorchScript-compatible. To support this, we have to convert it during the export process.
      This function will convert past values from a list to tuple(tuple(torch.FloatTensor)) for
      the inner decoder.
  
      According to the definition of past_key_values, each inner tuple(torch.FloatTensor) has 4 tensors,
      so we convert every 4 elements in the list as a tuple(torch.FloatTensor).
      """
      count_of_each_inner_tuple = 4
      results = ()
      temp_result = ()
      count_n = len(past_key_values) // count_of_each_inner_tuple
      for idx in range(count_n):
          real_idx = idx * count_of_each_inner_tuple
          temp_result = tuple(
              past_key_values[
                  real_idx : real_idx + count_of_each_inner_tuple
              ]
          )
          results += ((temp_result),)
  
      return results
  
imports: import copy
  import itertools
  from typing import List, Optional, Tuple
  import torch
  import torch.nn.functional
  from transformers import BartConfig
  from transformers.generation_utils import GenerationMixin
label_desc: Use image node_id 1 for calling a global function with example usage: _convert_past_list_to_tuple(past_key_values) and returns: results