class_docstr: A mixedin class for nano keras Sequential and Model, adding more functions for Inference.
docstr: Trace a Keras model and convert it into an accelerated module for inference.
  
  :param accelerator: The accelerator to use, defaults to None meaning staying in Keras
                      backend. 'openvino' and 'onnxruntime' are supported for now.
  :param input_spec: (optional) A (tuple or list of) ``tf.TensorSpec``
                     defining the shape/dtype of the input. If ``accelerator='onnxruntime'``,
                     ``input_spec`` is required. If ``accelerator='openvino'``,
                     ``input_spec`` is only required when you have a custom Keras model.
  :param thread_num: (optional) a int represents how many threads(cores) is needed for
                     inference, only valid for accelerator='onnxruntime'
                     or accelerator='openvino'.
  :param onnxruntime_session_options: The session option for onnxruntime, only valid when
                                      accelerator='onnxruntime', otherwise will be ignored.
  :param openvino_config: The config to be inputted in core.compile_model. Only valid when
                          accelerator='openvino', otherwise will be ignored.
  :param logging: whether to log detailed information of model conversion, only valid when
                  accelerator='openvino', otherwise will be ignored. Default: ``True``.
  :return: Model with different acceleration(OpenVINO/ONNX Runtime).
  
  .. warning::
     This function will be deprecated in future release.
  
     Please use ``bigdl.nano.tf.keras.InferenceOptimizer.trace`` instead.
docstr_tok: ["Trace","a","Keras","model","and","convert","it","into","an","accelerated","module","for","inference",".",":","param","accelerator",":","The","accelerator","to","use",",","defaults","to","None","meaning","staying","in","Keras","backend",".","'openvino","'","and","'onnxruntime","'","are","supported","for","now",".",":","param","input_spec",":","(","optional",")","A","(","tuple","or","list","of",")","``","tf.TensorSpec","``","defining","the","shape\/dtype","of","the","input",".","If","``","accelerator='onnxruntime","'","``",",","``","input_spec","``","is","required",".","If","``","accelerator='openvino","'","``",",","``","input_spec","``","is","only","required","when","you","have","a","custom","Keras","model",".",":","param","thread_num",":","(","optional",")","a","int","represents","how","many","threads","(","cores",")","is","needed","for","inference",",","only","valid","for","accelerator='onnxruntime'","or","accelerator='openvino","'",".",":","param","onnxruntime_session_options",":","The","session","option","for","onnxruntime",",","only","valid","when","accelerator='onnxruntime","'",",","otherwise","will","be","ignored",".",":","param","openvino_config",":","The","config","to","be","inputted","in","core.compile_model",".","Only","valid","when","accelerator='openvino","'",",","otherwise","will","be","ignored",".",":","param","logging",":","whether","to","log","detailed","information","of","model","conversion",",","only","valid","when","accelerator='openvino","'",",","otherwise","will","be","ignored",".","Default",":","``","True","``",".",":","return",":","Model","with","different","acceleration","(","OpenVINO\/ONNX","Runtime",")",".","..","warning",":",":","This","function","will","be","deprecated","in","future","release",".","Please","use","``","bigdl.nano.tf.keras.InferenceOptimizer.trace","``","instead","."]
code: def trace(
      self,
      accelerator: Optional[str] = None,
      input_spec=None,
      thread_num: Optional[int] = None,
      onnxruntime_session_options=None,
      openvino_config=None,
      logging=True,
  ):
      """
      Trace a Keras model and convert it into an accelerated module for inference.
  
      :param accelerator: The accelerator to use, defaults to None meaning staying in Keras
                          backend. 'openvino' and 'onnxruntime' are supported for now.
      :param input_spec: (optional) A (tuple or list of) ``tf.TensorSpec``
                         defining the shape/dtype of the input. If ``accelerator='onnxruntime'``,
                         ``input_spec`` is required. If ``accelerator='openvino'``,
                         ``input_spec`` is only required when you have a custom Keras model.
      :param thread_num: (optional) a int represents how many threads(cores) is needed for
                         inference, only valid for accelerator='onnxruntime'
                         or accelerator='openvino'.
      :param onnxruntime_session_options: The session option for onnxruntime, only valid when
                                          accelerator='onnxruntime', otherwise will be ignored.
      :param openvino_config: The config to be inputted in core.compile_model. Only valid when
                              accelerator='openvino', otherwise will be ignored.
      :param logging: whether to log detailed information of model conversion, only valid when
                      accelerator='openvino', otherwise will be ignored. Default: ``True``.
      :return: Model with different acceleration(OpenVINO/ONNX Runtime).
  
      .. warning::
         This function will be deprecated in future release.
  
         Please use ``bigdl.nano.tf.keras.InferenceOptimizer.trace`` instead.
      """
      from bigdl.nano.tf.keras import InferenceOptimizer
  
      return InferenceOptimizer.trace(
          model=self,
          accelerator=accelerator,
          input_spec=input_spec,
          thread_num=thread_num,
          onnxruntime_session_options=onnxruntime_session_options,
          openvino_config=openvino_config,
          logging=logging,
      )
  
file_path: BigDL/python/nano/src/bigdl/nano/tf/keras/inference_utils.py
imports: from typing import Optional, List, Union
  import numpy
  import tensorflow
  from tensorflow.keras.metrics import Metric
  from bigdl.nano.utils.common import deprecated
label_desc: Use image node_id 2 for calling the InferenceUtils obj's underlying member method code with example usage: obj.trace(accelerator, input_spec, thread_num, onnxruntime_session_options, openvino_config, logging) and returns: InferenceOptimizer