docstr: Validate parameters are correctly exported
  GPT2 has "past" parameter in the middle of input_ids, token_type_ids and attention_mask.
  ONNX doesn't support export with a dictionary, only a tuple. Thus we need to ensure we remove
  token_type_ids and attention_mask for now to not having a None tensor in the middle
docstr_tok: ["Validate","parameters","are","correctly","exported","GPT2","has","``","past","''","parameter","in","the","middle","of","input_ids",",","token_type_ids","and","attention_mask",".","ONNX","does","n't","support","export","with","a","dictionary",",","only","a","tuple",".","Thus","we","need","to","ensure","we","remove","token_type_ids","and","attention_mask","for","now","to","not","having","a","None","tensor","in","the","middle"]
code: def test_ensure_valid_input(self):
      """
      Validate parameters are correctly exported
      GPT2 has "past" parameter in the middle of input_ids, token_type_ids and attention_mask.
      ONNX doesn't support export with a dictionary, only a tuple. Thus we need to ensure we remove
      token_type_ids and attention_mask for now to not having a None tensor in the middle
      """
      # All generated args are valid
      input_names = ["input_ids", "attention_mask", "token_type_ids"]
      tokens = {
          "input_ids": [1, 2, 3, 4],
          "attention_mask": [0, 0, 0, 0],
          "token_type_ids": [1, 1, 1, 1],
      }
      ordered_input_names, inputs_args = ensure_valid_input(
          FuncContiguousArgs(), tokens, input_names
      )
  
      # Should have exactly the same number of args (all are valid)
      self.assertEqual(len(inputs_args), 3)
  
      # Should have exactly the same input names
      self.assertEqual(set(ordered_input_names), set(input_names))
  
      # Parameter should be reordered according to their respective place in the function:
      # (input_ids, token_type_ids, attention_mask)
      self.assertEqual(
          inputs_args,
          (
              tokens["input_ids"],
              tokens["token_type_ids"],
              tokens["attention_mask"],
          ),
      )
  
      # Generated args are interleaved with another args (for instance parameter "past" in GPT2)
      ordered_input_names, inputs_args = ensure_valid_input(
          FuncNonContiguousArgs(), tokens, input_names
      )
  
      # Should have exactly the one arg (all before the one not provided "some_other_args")
      self.assertEqual(len(inputs_args), 1)
      self.assertEqual(len(ordered_input_names), 1)
  
      # Should have only "input_ids"
      self.assertEqual(inputs_args[0], tokens["input_ids"])
      self.assertEqual(ordered_input_names[0], "input_ids")
  
imports: import unittest
  from pathlib import Path
  from tempfile import NamedTemporaryFile, TemporaryDirectory
  from transformers import BertConfig, BertTokenizerFast, FeatureExtractionPipeline
  from transformers.convert_graph_to_onnx import convert, ensure_valid_input, generate_identified_filename, infer_shapes, quantize
  from transformers.testing_utils import require_tf, require_tokenizers, require_torch, slow
label_desc: Use image node_id 10 for calling the OnnxExportTestCase obj's underlying member method code with example usage: obj.test_ensure_valid_input() without return types