parameters: (self, model, path, input_spec=None, **config)
docstring: Save the quantized model for the inference.
  
          Args:
              model (Layer): The model to be saved.
              path (str): The path prefix to save model. The format is 
                  ``dirname/file_prefix`` or ``file_prefix``.
              input_spec (list[InputSpec|Tensor], optional): Describes the input
                  of the saved model's forward method, which can be described by
                  InputSpec or example Tensor. If None, all input variables of 
                  the original Layer's forward method would be the inputs of
                  the saved model. Default None.
              **configs (dict, optional): Other save configuration options for
                  compatibility. We do not recommend using these configurations,
                  they may be removed in the future. If not necessary, DO NOT use
                  them. Default None.
                  The following options are currently supported:
                  (1) output_spec (list[Tensor]): Selects the output targets of
                  the saved model. By default, all return variables of original
                  Layer's forward method are kept as the output of the saved model.
                  If the provided ``output_spec`` list is not all output variables, 
                  the saved model will be pruned according to the given
                  ``output_spec`` list. 
  
          Returns:
              None
docstring_summary: Save the quantized model for the inference.
docstring_tokens: Save the quantized model for the inference .
function: def save_quantized_model(self, model, path, input_spec=None, **config):
          """
          Save the quantized model for the inference.
  
          Args:
              model (Layer): The model to be saved.
              path (str): The path prefix to save model. The format is 
                  ``dirname/file_prefix`` or ``file_prefix``.
              input_spec (list[InputSpec|Tensor], optional): Describes the input
                  of the saved model's forward method, which can be described by
                  InputSpec or example Tensor. If None, all input variables of 
                  the original Layer's forward method would be the inputs of
                  the saved model. Default None.
              **configs (dict, optional): Other save configuration options for
                  compatibility. We do not recommend using these configurations,
                  they may be removed in the future. If not necessary, DO NOT use
                  them. Default None.
                  The following options are currently supported:
                  (1) output_spec (list[Tensor]): Selects the output targets of
                  the saved model. By default, all return variables of original
                  Layer's forward method are kept as the output of the saved model.
                  If the provided ``output_spec`` list is not all output variables, 
                  the saved model will be pruned according to the given
                  ``output_spec`` list. 
  
          Returns:
              None
          """
          assert isinstance(model, dygraph.Layer), \
              "The model must be the instance of dygraph.Layer."
  
          paddle.jit.save(layer=model, path=path, input_spec=input_spec, **config)
  
          is_dynamic_mode = False
          if paddle.in_dynamic_mode():
              is_dynamic_mode = True
              paddle.enable_static()
  
          place = core.CPUPlace()
          scope = global_scope()
          exe = Executor(place)
  
          dirname = os.path.dirname(path)
          basename = os.path.basename(path)
          model_filename = basename + INFER_MODEL_SUFFIX
          params_filename = basename + INFER_PARAMS_SUFFIX
  
          [infer_program, feed_target_names, fetch_targets] = (
              load_inference_model(
                  dirname=dirname,
                  executor=exe,
                  model_filename=model_filename,
                  params_filename=params_filename))
  
          self._gather_scales(infer_program, scope, fetch_targets)
  
          # Remove `moving_average_abs_max_scale` node in sub graphs.
          graph = IrGraph(core.Graph(infer_program.desc), for_test=False)
          for sub_graph in graph.all_sub_graphs():
              for _op in sub_graph.all_op_nodes():
                  if _op.name() == "moving_average_abs_max_scale":
                      sub_graph.safe_remove_nodes(_op)
              sub_graph.resolve_hazard()
          infer_program = graph.to_program()
  
          self._set_skip_quant_attr(infer_program)
  
          save_inference_model(
              dirname=dirname,
              feeded_var_names=feed_target_names,
              target_vars=fetch_targets,
              executor=exe,
              main_program=infer_program.clone(),
              model_filename=model_filename,
              params_filename=params_filename,
              clip_extra=False)
  
          if is_dynamic_mode:
              paddle.disable_static()
function_tokens: def save_quantized_model ( self , model , path , input_spec = None , * * config ) : assert isinstance ( model , dygraph . Layer ) , "The model must be the instance of dygraph.Layer." paddle . jit . save ( layer = model , path = path , input_spec = input_spec , * * config ) is_dynamic_mode = False if paddle . in_dynamic_mode ( ) : is_dynamic_mode = True paddle . enable_static ( ) place = core . CPUPlace ( ) scope = global_scope ( ) exe = Executor ( place ) dirname = os . path . dirname ( path ) basename = os . path . basename ( path ) model_filename = basename + INFER_MODEL_SUFFIX params_filename = basename + INFER_PARAMS_SUFFIX [ infer_program , feed_target_names , fetch_targets ] = ( load_inference_model ( dirname = dirname , executor = exe , model_filename = model_filename , params_filename = params_filename ) ) self . _gather_scales ( infer_program , scope , fetch_targets ) # Remove `moving_average_abs_max_scale` node in sub graphs. graph = IrGraph ( core . Graph ( infer_program . desc ) , for_test = False ) for sub_graph in graph . all_sub_graphs ( ) : for _op in sub_graph . all_op_nodes ( ) : if _op . name ( ) == "moving_average_abs_max_scale" : sub_graph . safe_remove_nodes ( _op ) sub_graph . resolve_hazard ( ) infer_program = graph . to_program ( ) self . _set_skip_quant_attr ( infer_program ) save_inference_model ( dirname = dirname , feeded_var_names = feed_target_names , target_vars = fetch_targets , executor = exe , main_program = infer_program . clone ( ) , model_filename = model_filename , params_filename = params_filename , clip_extra = False ) if is_dynamic_mode : paddle . disable_static ( )