save

Note: This API is only avaliable in [Static Graph] mode

paddle.fluid.save(program, model_path)[source]

This function save parameters, optimizer information and network description to model_path.

The parameters contains all the trainable Variable, will save to a file with suffix “.pdparams”. The optimizer information contains all the variable used by optimizer. For Adam optimizer, contains beta1, beta2, momentum etc. All the information will save to a file with suffix “.pdopt”. (If the optimizer have no variable need to save (like SGD), the fill will not generated). The network description is the description of the program. It’s only used for deployment. The description will save to a file with a suffix “.pdmodel”.

Parameters
  • program (Program) – The program to saved.

  • model_path (str) – the file prefix to save the program. The format is “dirname/file_prefix”. If file_prefix is empty str. A exception will be raised

Returns

None

Examples

import paddle.fluid as fluid

prog = fluid.default_main_program()
fluid.save( prog, "./temp")