convert_to_mixed_precision

paddle.inference. convert_to_mixed_precision ( model_file: str, params_file: str, mixed_model_file: str, mixed_params_file: str, mixed_precision: paddle.base.libpaddle.AnalysisConfig.Precision, backend: paddle.base.libpaddle.PaddlePlace, keep_io_types: bool = True, black_list: Set[str] = {}, **kwargs ) [source]

Convert a fp32 model to mixed precision model.

Parameters
  • model_file – fp32 model file, e.g. inference.pdmodel.

  • params_file – fp32 params file, e.g. inference.pdiparams.

  • mixed_model_file – The storage path of the converted mixed-precision model.

  • mixed_params_file – The storage path of the converted mixed-precision params.

  • mixed_precision – The precision, e.g. PrecisionType.Half.

  • backend – The backend, e.g. PlaceType.GPU.

  • keep_io_types – Whether the model input and output dtype remains unchanged.

  • black_list – Operators that do not convert precision.

  • kwargs – Supported keys including ‘white_list’. - white_list: Operators that do convert precision.