code: def test_onnx_runtime_optimize(self):
      if not self.test_onnx:
          return
  
      import onnxruntime
      import tf2onnx
  
      (
          config,
          inputs_dict,
      ) = self.model_tester.prepare_config_and_inputs_for_common()
  
      for model_class in self.all_model_classes:
          # Skip these 2 classes which uses `tf.gather` with `batch_dims=1`
          if model_class in [
              TFGPT2ForSequenceClassification,
              TFGPT2DoubleHeadsModel,
          ]:
              continue
  
          model = model_class(config)
          model.build_in_name_scope()
  
          onnx_model_proto, _ = tf2onnx.convert.from_keras(
              model, opset=self.onnx_min_opset
          )
  
          onnxruntime.InferenceSession(
              onnx_model_proto.SerializeToString()
          )
  
imports: from __future__ import annotations
  import unittest
  from transformers import GPT2Config, is_tf_available
  from transformers.testing_utils import require_tf, require_tf2onnx, slow
  from ...test_configuration_common import ConfigTester
  from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask
  from ...test_pipeline_mixin import PipelineTesterMixin
  from ...utils.test_modeling_tf_core import TFCoreModelTesterMixin
label_desc: Use image node_id 11 for calling the TFGPT2ModelTest obj's underlying member method code with example usage: obj.test_onnx_runtime_optimize() without return types