docstr: Save the model to local file.
  
  :param model: Any model of keras.Model, including all models accelareted by
         InferenceOptimizer.trace/InferenceOptimizer.quantize.
  :param path: Path to saved model. Path should be a directory.
docstr_tok: ["Save","the","model","to","local","file",".",":","param","model",":","Any","model","of","keras.Model",",","including","all","models","accelareted","by","InferenceOptimizer.trace\/InferenceOptimizer.quantize",".",":","param","path",":","Path","to","saved","model",".","Path","should","be","a","directory","."]
code: def save(model: Model, path):
      """
      Save the model to local file.
  
      :param model: Any model of keras.Model, including all models accelareted by
             InferenceOptimizer.trace/InferenceOptimizer.quantize.
      :param path: Path to saved model. Path should be a directory.
      """
      import yaml
  
      path = Path(path)
      path.mkdir(parents=path.parent, exist_ok=True)
      if hasattr(model, "_save"):
          model._save(path)
      else:
          # typically for keras Model
          meta_path = Path(path) / "nano_model_meta.yml"
          with open(meta_path, "w+") as f:
              metadata = {
                  "ModelType": "KerasModel",
                  "checkpoint": "saved_weight.ckpt",
              }
              yaml.safe_dump(metadata, f)
          checkpoint_path = path / metadata["checkpoint"]
          model.save(checkpoint_path)
  
imports: import os
  import subprocess
  import tempfile
  import cloudpickle
  import copy
  import time
  import operator
  from pathlib import Path
  import numpy
  import traceback
  import inspect
  import sigfig
  import tensorflow
  import keras
  from typing import Dict, Optional, List, Union, Callable
  from bigdl.nano.utils.common import BaseInferenceOptimizer, available_acceleration_combination, AccelerationOption, latency_calculate_helper, format_optimize_result
  from bigdl.nano.utils.common import invalidInputError
  from bigdl.nano.utils.tf import _ModuleWrapper
  from bigdl.nano.utils.tf import patch_compiled_and_attrs, patch_attrs
  from tensorflow.keras import Model
  from tensorflow.data import Dataset
  from tensorflow.keras.metrics import Metric
  from bigdl.nano.deps.neural_compressor.inc_api import quantize
  from bigdl.nano.deps.openvino.openvino_api import KerasOpenVINOModel
  from bigdl.nano.deps.onnxruntime.onnxruntime_api import KerasONNXRuntimeModel
  from bigdl.nano.deps.openvino.openvino_api import load_openvino_model
  from bigdl.nano.deps.onnxruntime.onnxruntime_api import load_onnxruntime_model
  from bigdl.nano.deps.neural_compressor.inc_api import load_inc_model
  from bigdl.nano.tf.keras.amp import BF16Model, load_bf16_model
  from bigdl.nano.utils.common import compare_version
  from bigdl.nano.utils.tf import try_fake_inference
label_desc: Use image node_id 4 for calling the InferenceOptimizer obj's underlying member method code with example usage: obj.save(model, path) without return types