code: def _optimize(
      self,
      model: Any,
      model_outputs: Iterable,
      input_data: types.InputData,
      optimization_time: OptimizationTime,
      metric_drop_ths: float,
      metric: Callable,
      model_params: ModelParams,
      ignore_compilers: List[ModelCompiler],
      ignore_compressors: List[ModelCompressor],
      source_dl_framework: DeepLearningFramework,
      pipeline_idx: int,
      len_pipelines: int,
      is_diffusion: bool,
  ) -> List[OptimizedModel]:
      if isinstance(model, torch.nn.Module):
          optimization_op = self.torch_optimization_op
          self.logger.info(
              f"[{pipeline_idx}/{len_pipelines}] Running PyTorch "
              f"Optimization Pipeline"
          )
      elif isinstance(model, tf.Module):
          optimization_op = self.tensorflow_optimization_op
          self.logger.info(
              f"[{pipeline_idx}/{len_pipelines}] Running TensorFlow "
              f"Optimization Pipeline"
          )
      else:
          optimization_op = self.onnx_optimization_op
          self.logger.info(
              f"[{pipeline_idx}/{len_pipelines}] Running ONNX "
              f"Optimization Pipeline"
          )
  
      # Run optimization
      optimized_models = optimization_op.to(self.device).execute(
          model=model,
          input_data=input_data,
          optimization_time=optimization_time,
          metric_drop_ths=metric_drop_ths,
          metric=metric,
          model_params=model_params,
          model_outputs=model_outputs,
          ignore_compilers=ignore_compilers,
          ignore_compressors=ignore_compressors,
          source_dl_framework=source_dl_framework,
          is_diffusion=is_diffusion,
      )
  
      if isinstance(model, torch.nn.Module):
          optimization_op.free_model_gpu(model)
  
      return optimized_models
  
imports: from pathlib import Path
  from tempfile import TemporaryDirectory
  from typing import Any, Iterable, Callable, List, Union, Dict, Optional
  from nebullvm.config import TRAIN_TEST_SPLIT_RATIO
  from nebullvm.core import types
  from nebullvm.core.models import OptimizeInferenceResult, OriginalModel, OptimizedModel, BenchmarkOriginalModelResult, ModelCompiler, ModelCompressor, OptimizationTime, ModelParams, DeepLearningFramework
  from nebullvm.operations.base import Operation
  from nebullvm.operations.conversions.utils import get_conversion_op
  from nebullvm.operations.measures.measures import LatencyOriginalModelMeasure
  from nebullvm.operations.measures.utils import QUANTIZATION_METRIC_MAP
  from nebullvm.operations.optimizations.optimizers.optimizers import PytorchOptimizer, TensorflowOptimizer, ONNXOptimizer
  from nebullvm.operations.optimizations.utils import map_compilers_and_compressors
  from nebullvm.optional_modules.tensorflow import tensorflow
  from nebullvm.optional_modules.torch import DataLoader
  from nebullvm.optional_modules.torch import torch
  from nebullvm.optional_modules.utils import check_dependencies
  from nebullvm.tools.adapters import ModelAdapter, DiffusionAdapter, HuggingFaceAdapter
  from nebullvm.tools.data import DataManager
  from nebullvm.tools.diffusers import is_diffusion_model_pipe, is_diffusion_model
  from nebullvm.tools.hardware_utils import get_hw_setup
  from nebullvm.tools.utils import is_huggingface_data, check_input_data, is_data_subscriptable, get_dl_framework, extract_info_from_data, get_model_name, get_model_size_mb, get_throughput
label_desc: Use image node_id 5 for calling the OptimizeInferenceOp obj's underlying member method code with example usage: obj._optimize(model, model_outputs, input_data, optimization_time, metric_drop_ths, metric, model_params, ignore_compilers, ignore_compressors, source_dl_framework, pipeline_idx, len_pipelines, is_diffusion) and returns: optimized_models