io

save_vars

paddle.v2.fluid.io.save_vars(executor, dirname, main_program=None, vars=None, predicate=None)

Save variables to directory by executor.

参数:
  • 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 variables will be saved. :param vars: variables need to be saved. If specify vars, program & predicate will be ignored :return: None

save_params

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

Save all parameters to directory with executor.

save_persistables

paddle.v2.fluid.io.save_persistables(executor, dirname, main_program=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 variables from directory by executor.

参数:
  • 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 variables will be loaded. :param vars: variables need to be loaded. If specify vars, program & predicate will be ignored :return: None

load_params

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

load all parameters from directory by executor.

load_persistables

paddle.v2.fluid.io.load_persistables(executor, dirname, main_program=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)

Build a model especially for inference, and save it to directory by the executor.

参数:
  • 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().
返回:

None

load_inference_model

paddle.v2.fluid.io.load_inference_model(dirname, executor)

Load inference model from a directory

参数:
  • dirname – directory path
  • executor – executor that load inference model
返回:

[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)