docstr: Create a Intel Neural Compressor Quantization object. To understand INC quantization,
  please refer to https://github.com/intel/neural-compressor/blob/master/docs/Quantization.md.
  
  :param framework:   'tensorflow', 'pytorch', 'pytorch_fx', 'pytorch_ipex', 'onnxrt_integer',
                      'onnxrt_qlinear' or 'mxnet'; allow new framework backend extension.
                      Default: 'pytorch_fx'. Consistent with Intel Neural Compressor
                      Quantization.
  :param conf:        A path to conf yaml file for quantization.
                      Default: None, using default config.
  :param approach:    'post_training_static_quant', 'post_training_dynamic_quant',
                      'quant_aware_training'.
                      Default: 'post_training_static_quant'.
  :param tuning_strategy:    'bayesian', 'basic', 'mse', 'sigopt'. Default: 'bayesian'.
  :param accuracy_criterion:  Tolerable accuracy drop.
                              accuracy_criterion = {'absolute':0.99, 'higher_is_better':False}
                              means accuracy loss must be smaller than 0.99. For example, if
                              higher_is_better is True, then this requires original metric
                              value subtract current metric value be smaller than 0.99.
                              accuracy_criterion = {'relative':0.1, 'higher_is_better':True}
                              allows relative accuracy loss: 10%.
  :param eval_func:       A evaluation function which only accepts model as input and return
                          evaluation value. This parameter provides a higher degree of
                          freedom than using eval_loader and metric. Default to None meaning
                          no performance tuning, but it would be better give an evaluation
                          function to get better quantization performance.
  :param timeout:     Tuning timeout (seconds). Default: 0,  which means early stop.
                      combine with max_trials field to decide when to exit.
  :param max_trials:  Max tune times. Default: 1.
                      Combine with timeout field to decide when to exit.
  :param inputs:      For tensorflow to specify names of inputs. e.g. inputs=['img',]
  :param outputs:     For tensorflow to specify names of outputs. e.g. outputs=['logits',]
docstr_tok: ["Create","a","Intel","Neural","Compressor","Quantization","object",".","To","understand","INC","quantization",",","please","refer","to","https",":","\/\/github.com\/intel\/neural-compressor\/blob\/master\/docs\/Quantization.md",".",":","param","framework",":","'tensorflow","'",",","'pytorch","'",",","'pytorch_fx","'",",","'pytorch_ipex","'",",","'onnxrt_integer","'",",","'onnxrt_qlinear","'","or","'mxnet","'",";","allow","new","framework","backend","extension",".","Default",":","'pytorch_fx","'",".","Consistent","with","Intel","Neural","Compressor","Quantization",".",":","param","conf",":","A","path","to","conf","yaml","file","for","quantization",".","Default",":","None",",","using","default","config",".",":","param","approach",":","'post_training_static_quant","'",",","'post_training_dynamic_quant","'",",","'quant_aware_training","'",".","Default",":","'post_training_static_quant","'",".",":","param","tuning_strategy",":","'bayesian","'",",","'basic","'",",","'mse","'",",","'sigopt","'",".","Default",":","'bayesian","'",".",":","param","accuracy_criterion",":","Tolerable","accuracy","drop",".","accuracy_criterion","=","{","'absolute':0.99",",","'higher_is_better","'",":","False","}","means","accuracy","loss","must","be","smaller","than","0.99",".","For","example",",","if","higher_is_better","is","True",",","then","this","requires","original","metric","value","subtract","current","metric","value","be","smaller","than","0.99.","accuracy_criterion","=","{","'relative':0.1",",","'higher_is_better","'",":","True","}","allows","relative","accuracy","loss",":","10","%",".",":","param","eval_func",":","A","evaluation","function","which","only","accepts","model","as","input","and","return","evaluation","value",".","This","parameter","provides","a","higher","degree","of","freedom","than","using","eval_loader","and","metric",".","Default","to","None","meaning","no","performance","tuning",",","but","it","would","be","better","give","an","evaluation","function","to","get","better","quantization","performance",".",":","param","timeout",":","Tuning","timeout","(","seconds",")",".","Default",":","0",",","which","means","early","stop",".","combine","with","max_trials","field","to","decide","when","to","exit",".",":","param","max_trials",":","Max","tune","times",".","Default",":","1",".","Combine","with","timeout","field","to","decide","when","to","exit",".",":","param","inputs",":","For","tensorflow","to","specify","names","of","inputs",".","e.g",".","inputs=","[","'img","'",",","]",":","param","outputs",":","For","tensorflow","to","specify","names","of","outputs",".","e.g",".","outputs=","[","'logits","'",",","]"]
code: def __init__(
      self,
      framework: str,
      conf=None,
      approach="post_training_static_quant",
      tuning_strategy="bayesian",
      accuracy_criterion: dict = {
          "relative": 0.99,
          "higher_is_better": True,
      },
      eval_func=None,
      timeout=0,
      max_trials=1,
      inputs=None,
      outputs=None,
  ):
      """
      Create a Intel Neural Compressor Quantization object. To understand INC quantization,
      please refer to https://github.com/intel/neural-compressor/blob/master/docs/Quantization.md.
  
      :param framework:   'tensorflow', 'pytorch', 'pytorch_fx', 'pytorch_ipex', 'onnxrt_integer',
                          'onnxrt_qlinear' or 'mxnet'; allow new framework backend extension.
                          Default: 'pytorch_fx'. Consistent with Intel Neural Compressor
                          Quantization.
      :param conf:        A path to conf yaml file for quantization.
                          Default: None, using default config.
      :param approach:    'post_training_static_quant', 'post_training_dynamic_quant',
                          'quant_aware_training'.
                          Default: 'post_training_static_quant'.
      :param tuning_strategy:    'bayesian', 'basic', 'mse', 'sigopt'. Default: 'bayesian'.
      :param accuracy_criterion:  Tolerable accuracy drop.
                                  accuracy_criterion = {'absolute':0.99, 'higher_is_better':False}
                                  means accuracy loss must be smaller than 0.99. For example, if
                                  higher_is_better is True, then this requires original metric
                                  value subtract current metric value be smaller than 0.99.
                                  accuracy_criterion = {'relative':0.1, 'higher_is_better':True}
                                  allows relative accuracy loss: 10%.
      :param eval_func:       A evaluation function which only accepts model as input and return
                              evaluation value. This parameter provides a higher degree of
                              freedom than using eval_loader and metric. Default to None meaning
                              no performance tuning, but it would be better give an evaluation
                              function to get better quantization performance.
      :param timeout:     Tuning timeout (seconds). Default: 0,  which means early stop.
                          combine with max_trials field to decide when to exit.
      :param max_trials:  Max tune times. Default: 1.
                          Combine with timeout field to decide when to exit.
      :param inputs:      For tensorflow to specify names of inputs. e.g. inputs=['img',]
      :param outputs:     For tensorflow to specify names of outputs. e.g. outputs=['logits',]
      """
      qconf = Quantization_Conf(conf)
      self.validate_config(
          framework=framework,
          approach=approach,
          tuning_strategy=tuning_strategy,
          accuracy_criterion=accuracy_criterion,
          timeout=timeout,
          max_trials=max_trials,
          inputs=inputs,
          outputs=outputs,
      )
      cfg = qconf.usr_cfg
      # Override default config
      cfg.model.framework = framework
      cfg.quantization.approach = approach
      cfg.tuning.strategy.name = tuning_strategy
      cfg.tuning.accuracy_criterion = accuracy_criterion
      cfg.tuning.exit_policy.timeout = timeout
      cfg.tuning.exit_policy.max_trials = max_trials
      cfg.model.inputs = inputs
      cfg.model.outputs = outputs
      super().__init__(qconf)
      if eval_func is not None:
          self._eval_func = eval_func
          self._eval_func.builtin = True
  
file_path: BigDL/python/nano/src/bigdl/nano/deps/neural_compressor/core/quantization.py
imports: from bigdl.nano.utils.common import invalidInputError
  from neural_compressor.conf.config import Quantization_Conf
  from neural_compressor.experimental import Quantization, common
label_desc: Use image node_id 1 to create a new BaseQuantization object from inherited base classes: Quantization with example: obj = BaseQuantization(framework, conf, approach, tuning_strategy, accuracy_criterion, eval_func, timeout, max_trials, inputs, outputs)