class_docstr: Integration tests ensuring supported models are correctly exported.
class_docstr_tok: ["Integration","tests","ensuring","supported","models","are","correctly","exported","."]
code: def _tflite_export(
      self,
      model_name: str,
      tflite_config_constructor: "ExportConfigConstructor",
      task: Optional[str] = None,
      quantization: Optional[str] = None,
      fallback_to_float: bool = False,
      inputs_dtype: Optional[str] = None,
      outputs_dtype: Optional[str] = None,
      calibration_dataset_name_or_path: Optional[str] = None,
      calibration_dataset_config_name: Optional[str] = None,
      num_calibration_samples: int = 200,
      calibration_split: Optional[str] = None,
      primary_key: Optional[str] = None,
      secondary_key: Optional[str] = None,
      question_key: Optional[str] = None,
      context_key: Optional[str] = None,
      image_key: Optional[str] = None,
  ):
      with TemporaryDirectory() as tmpdir:
          command = f"python3 -m optimum.exporters.tflite --model {model_name}".split()
          if task is not None:
              command.append(f"--task={task}")
          if quantization is not None:
              command.append(f"--quantize={quantization}")
          if fallback_to_float:
              command.append("--fallback_to_float")
          if inputs_dtype is not None:
              command.append(f"--inputs_type={inputs_dtype}")
          if outputs_dtype is not None:
              command.append(f"--outputs_type={outputs_dtype}")
          if calibration_dataset_name_or_path is not None:
              command.append(
                  f"--calibration_dataset={calibration_dataset_name_or_path}"
              )
          if calibration_dataset_config_name is not None:
              command.append(
                  f"--calibration_dataset_config_name={calibration_dataset_config_name}"
              )
          if calibration_split is not None:
              command.append(f"--calibration_split={calibration_split}")
          if primary_key is not None:
              command.append(f"--primary_key={primary_key}")
          if secondary_key is not None:
              command.append(f"--secondary_key={secondary_key}")
          if question_key is not None:
              command.append(f"--question_key={question_key}")
          if context_key is not None:
              command.append(f"--context_key={context_key}")
          if image_key is not None:
              command.append(f"--image_key={image_key}")
          command.append(
              f"--num_calibration_samples={num_calibration_samples}"
          )
  
          tflite_config = tflite_config_constructor(
              AutoConfig.from_pretrained(model_name)
          )
          mandatory_axes = tflite_config.get_mandatory_axes_for_task(
              task
          )
          shapes = [
              f"--{name}={getattr(tflite_config, name)}"
              for name in mandatory_axes
          ]
          command += shapes
          command.append(tmpdir)
  
          proc = subprocess.Popen(
              command, stdout=subprocess.PIPE, stderr=subprocess.PIPE
          )
          outs, errs = proc.communicate()
          # Convenient to see the output with -s in PyTest.
          print(outs.decode("utf-8"))
          print(errs.decode("utf-8"))
          not_supported = quantization is not None and (
              not tflite_config.supports_quantization_approach(
                  quantization
              )
              and not fallback_to_float
          )
          if not_supported:
              self.assertIn(
                  "QuantizationApproachNotSupported",
                  errs.decode("utf-8"),
              )
          else:
              self.assertEqual(proc.returncode, 0)
  
imports: import unittest
  from tempfile import TemporaryDirectory
  from typing import TYPE_CHECKING, Dict, Optional
  import pytest
  from parameterized import parameterized
  from transformers import AutoConfig, is_tf_available
  from transformers.testing_utils import require_tf
  from optimum.utils import DEFAULT_DUMMY_SHAPES
  from ...utils.test_task_processors import TASK_TO_NON_DEFAULT_DATASET
  from ..exporters_utils import PYTORCH_EXPORT_MODELS_TINY
  import subprocess
label_desc: Use image node_id 1 for calling the TFLiteCLIExportTestCase obj's underlying member method code with example usage: obj._tflite_export(model_name, tflite_config_constructor, task, quantization, fallback_to_float, inputs_dtype, outputs_dtype, calibration_dataset_name_or_path, calibration_dataset_config_name, num_calibration_samples, calibration_split, primary_key, secondary_key, question_key, context_key, image_key) without return types