code: def optimize():
      save_dir = "models"
  
      model = ResNet50(
          weights=None, input_shape=[40, 40, 3], classes=10
      )
      input_examples = np.random.random((100, 40, 40, 3))
      input_labels = np.random.randint(0, 10, size=100)
  
      if "OMP_NUM_THREADS" in os.environ:
          thread_num = int(os.environ["OMP_NUM_THREADS"])
      else:
          thread_num = None
  
      opt = InferenceOptimizer()
      opt.optimize(
          model=model,
          x=input_examples,
          y=input_labels,
          thread_num=thread_num,
          latency_sample_num=10,
      )
  
      os.makedirs(save_dir, exist_ok=True)
      options = list(
          InferenceOptimizer.ALL_INFERENCE_ACCELERATION_METHOD.keys()
      )
      for option in options:
          try:
              model = opt.get_model(option)
              opt.save(model, os.path.join(save_dir, option))
          except Exception:
              pass
  
imports: import os
  import numpy
  import tensorflow
  from tensorflow.keras.applications import ResNet50
  from bigdl.nano.tf.keras import InferenceOptimizer
label_desc: Use image node_id 1 for calling a global function with example usage: optimize() without return types