io

save_vars

paddle.v2.fluid.io.save_vars(executor, dirname, main_program=None, vars=None, predicate=None, save_file_name=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 save_file_name: 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.v2.fluid.io.save_params(executor, dirname, main_program=None, save_file_name=None)

Save all parameters to directory with executor.

save_persistables

paddle.v2.fluid.io.save_persistables(executor, dirname, main_program=None, save_file_name=None)

Save all persistables to directory with executor.

load_vars

paddle.v2.fluid.io.load_vars(executor, dirname, main_program=None, vars=None, predicate=None, load_file_name=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 load_file_name: 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.v2.fluid.io.load_params(executor, dirname, main_program=None, load_file_name=None)

load all parameters from directory by executor.

load_persistables

paddle.v2.fluid.io.load_persistables(executor, dirname, main_program=None, load_file_name=None)

load all persistables from directory by executor.

save_inference_model

paddle.v2.fluid.io.save_inference_model(dirname, feeded_var_names, target_vars, executor, main_program=None, save_file_name=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().
  • save_file_name – The name of a single file that all parameters are saved to.

If it is None, save parameters to separate files.

Returns:None

load_inference_model

paddle.v2.fluid.io.load_inference_model(dirname, executor, load_file_name=None)

Load inference model from a directory

Parameters:
  • dirname – directory path
  • executor – executor that load inference model
  • load_file_name – The name of the single file that all parameters are loaded from.

If it is None, load parameters from 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.v2.fluid.io.get_inference_program(target_vars, main_program=None)