load_dygraph

paddle.fluid.dygraph.load_dygraph(model_path)[source]

Load parameter state_dict from disk.

Parameters

model_path (str) – The file prefix store the state_dict. (The path should Not contain suffix ‘.pdparams’)

Returns

the dict store the state_dict

Return type

state_dict(dict)

Examples

import paddle.fluid as fluid

with fluid.dygraph.guard():
    emb = fluid.dygraph.Embedding( "emb", [10, 10])

    state_dict = emb.state_dict()
    fluid.save_dygraph( state_dict, "paddle_dy")

    adam = fluid.optimizer.Adam( learning_rate = fluid.layers.noam_decay( 100, 10000) )
    state_dict = adam.state_dict()
    fluid.save_dygraph( state_dict, "padle_dy")

    para_state_dict, opti_state_dict = fluid.load_dygraph( "paddle_dy")