load_program_state

paddle.fluid.io.load_program_state(model_path, var_list=None)[source]

Load program state from local file

Parameters
  • model_path (str) – The file prefix store the program

  • var_list (list, optional) – The variable list to load saved with [ save_params, save_persistables, save_vars ]. Default: None. The var_list is only used to get name, will not be modified.

Returns

the dict store Parameter and optimizer information

Return type

state_dict(dict)

Examples

import paddle.fluid as fluid
x = fluid.data( name="x", shape=[10, 10], dtype='float32')
y = fluid.layers.fc( x, 10)
z = fluid.layers.fc( y, 10)

place = fluid.CPUPlace()
exe = fluid.Executor(place)
exe.run( fluid.default_startup_program() )
prog = fluid.default_main_program()

fluid.save( prog, "./temp")
program_state = fluid.load_program_state( "./temp")