code: def optimize(onnx_model_path: Path) -> Path:
      """
      Load the model at the specified path and let onnxruntime look at transformations on the graph to enable all the
      optimizations possible
  
      Args:
          onnx_model_path: filepath where the model binary description is stored
  
      Returns: Path where the optimized model binary description has been saved
  
      """
      from onnxruntime import InferenceSession, SessionOptions
  
      # Generate model name with suffix "optimized"
      opt_model_path = generate_identified_filename(
          onnx_model_path, "-optimized"
      )
      sess_option = SessionOptions()
      sess_option.optimized_model_filepath = opt_model_path.as_posix()
      _ = InferenceSession(onnx_model_path.as_posix(), sess_option)
  
      print(
          f"Optimized model has been written at {opt_model_path}: \N{heavy check mark}"
      )
      print(
          "/!\\ Optimized model contains hardware specific operators which might not be portable. /!\\"
      )
  
      return opt_model_path
  
imports: import warnings
  from argparse import ArgumentParser
  from os import listdir, makedirs
  from pathlib import Path
  from typing import Dict, List, Optional, Tuple
  from packaging.version import Version, parse
  from transformers.pipelines import Pipeline, pipeline
  from transformers.tokenization_utils import BatchEncoding
  from transformers.utils import ModelOutput, is_tf_available, is_torch_available
label_desc: Use image node_id 9 for calling a global function with example usage: optimize(onnx_model_path) and returns: opt_model_path