io¶
save_vars¶
-
paddle.fluid.io.
save_vars
(executor, dirname, main_program=None, vars=None, predicate=None, filename=None) Save variables to directory by executor.
Parameters: - executor – executor that save variable
- dirname – directory path
- main_program – program. If vars is None, then filter all variables in this
program which fit predicate. Default default_main_program. :param predicate: The Predicate describes a callable that returns a variable as a bool. If it returns true, the corresponding input variable will be saved. :param vars: variables need to be saved. If vars is specified, program & predicate will be ignored :param filename: The name of a single file that all vars are saved to.
If it is None, save variables to separate files.Returns: None
save_params¶
-
paddle.fluid.io.
save_params
(executor, dirname, main_program=None, filename=None) Save all parameters to directory with executor.
save_persistables¶
-
paddle.fluid.io.
save_persistables
(executor, dirname, main_program=None, filename=None) Save all persistables to directory with executor.
load_vars¶
-
paddle.fluid.io.
load_vars
(executor, dirname, main_program=None, vars=None, predicate=None, filename=None) Load variables from directory by executor.
Parameters: - executor – executor that load variable
- dirname – directory path
- main_program – program. If vars is None, then filter all variables in this
program which fit predicate. Default default_main_program(). :param predicate: The Predicate describes a callable that returns a variable as a bool. If it returns true, the corresponding input variable will be loaded. :param vars: variables need to be loaded. If vars is specified, program & predicate will be ignored :param filename: The name of the single file that all vars are loaded from.
If it is None, load variables from separate files.Returns: None
load_params¶
-
paddle.fluid.io.
load_params
(executor, dirname, main_program=None, filename=None) load all parameters from directory by executor.
load_persistables¶
-
paddle.fluid.io.
load_persistables
(executor, dirname, main_program=None, filename=None) load all persistables from directory by executor.
save_inference_model¶
-
paddle.fluid.io.
save_inference_model
(dirname, feeded_var_names, target_vars, executor, main_program=None, model_filename=None, params_filename=None) Build a model especially for inference, and save it to directory by the executor.
Parameters: - dirname – directory path
- feeded_var_names – Names of variables that need to be feeded data during inference
- target_vars – Variables from which we can get inference results.
- executor – executor that save inference model
- main_program – original program, which will be pruned to build the inference model. Default default_main_program().
- model_filename – The name of file to save inference program. If not specified, default filename __model__ will be used.
- params_filename – The name of file to save parameters. It is used for the case that all parameters are saved in a single binary file. If not specified, parameters are considered saved in separate files.
Returns: None
load_inference_model¶
-
paddle.fluid.io.
load_inference_model
(dirname, executor, model_filename=None, params_filename=None) Load inference model from a directory
Parameters: - dirname – directory path
- executor – executor that load inference model
- model_filename – The name of file to load inference program. If not specified, default filename __model__ will be used.
- params_filename – The name of file to load parameters. It is used for the case that all parameters are saved in a single binary file. If not specified, parameters are considered saved in separate files.
Returns: [program, feed_target_names, fetch_targets] program: program especially for inference. feed_target_names: Names of variables that need to feed data fetch_targets: Variables from which we can get inference results.
get_inference_program¶
-
paddle.fluid.io.
get_inference_program
(target_vars, main_program=None)