docstr: Compile the trained model for faster inference.
  
  Parameters
  ----------
  model
      The native model that is expected to be compiled.
  path : str
      The path for saving the compiled model.
  input_types : list, default=None
      A list of tuples containing shape and element type info, e.g. [((1, 14), np.float32),].
      The list would be used as the input data for the model.
      The compiler would optimize the model to perform best with the given input type.
docstr_tok: ["Compile","the","trained","model","for","faster","inference",".","Parameters","--","--","--","--","--","model","The","native","model","that","is","expected","to","be","compiled",".","path",":","str","The","path","for","saving","the","compiled","model",".","input_types",":","list",",","default=None","A","list","of","tuples","containing","shape","and","element","type","info",",","e.g",".","[","(","(","1",",","14",")",",","np.float32",")",",","]",".","The","list","would","be","used","as","the","input","data","for","the","model",".","The","compiler","would","optimize","the","model","to","perform","best","with","the","given","input","type","."]
code: def compile(model, path: str, input_types=None):
      """
      Compile the trained model for faster inference.
  
      Parameters
      ----------
      model
          The native model that is expected to be compiled.
      path : str
          The path for saving the compiled model.
      input_types : list, default=None
          A list of tuples containing shape and element type info, e.g. [((1, 14), np.float32),].
          The list would be used as the input data for the model.
          The compiler would optimize the model to perform best with the given input type.
      """
      if input_types is None or not isinstance(input_types[0], tuple):
          raise RuntimeError(
              "input_types argument should contain at least one tuple"
              ", e.g. [((1, 14), np.float32)]"
          )
      if isinstance(model, RFOnnxPredictor):
          return model
  
      from skl2onnx import convert_sklearn
      from skl2onnx.common.data_types import FloatTensorType
      from sklearn.ensemble import (
          ExtraTreesClassifier,
          RandomForestClassifier,
      )
  
      input_shape = list(input_types[0][0])
      initial_type = [("float_input", FloatTensorType(input_shape))]
  
      # Without ZipMap
      # See http://onnx.ai/sklearn-onnx/auto_examples/plot_convert_zipmap.html#without-zipmap
      options = {}
      if isinstance(
          model, (RandomForestClassifier, ExtraTreesClassifier)
      ):
          options = {id(model): {"zipmap": False}}
  
      # Convert the model to onnx
      onnx_model = convert_sklearn(
          model, initial_types=initial_type, options=options
      )
      predictor = RFOnnxPredictor(model=onnx_model)
      RFOnnxCompiler.save(onnx_model, path)
      return predictor
  
file_path: autogluon/tabular/src/autogluon/tabular/models/rf/compilers/onnx.py
imports: import os
  import numpy
label_desc: Use image node_id 2 for calling the RFOnnxCompiler obj's underlying member method code with example usage: obj.compile(model, path, input_types) and returns: predictor, model