未验证 提交 e89fb253 编写于 作者: W WeiXin 提交者: GitHub

Set the default value of protocol to 4. (#32904)

上级 62f6550b
...@@ -1788,7 +1788,7 @@ def _legacy_save(param_dict, model_path, protocol=2): ...@@ -1788,7 +1788,7 @@ def _legacy_save(param_dict, model_path, protocol=2):
@static_only @static_only
def save(program, model_path, protocol=2, **configs): def save(program, model_path, protocol=4, **configs):
""" """
:api_attr: Static Graph :api_attr: Static Graph
...@@ -1802,7 +1802,7 @@ def save(program, model_path, protocol=2, **configs): ...@@ -1802,7 +1802,7 @@ def save(program, model_path, protocol=2, **configs):
program(Program) : The program to saved. 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 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
protocol(int, optional): The protocol version of pickle module must be greater than 1 and less than 5. protocol(int, optional): The protocol version of pickle module must be greater than 1 and less than 5.
Default: 2 Default: 4
configs(dict, optional) : optional keyword arguments. configs(dict, optional) : optional keyword arguments.
Returns: Returns:
......
...@@ -491,7 +491,7 @@ def _save_binary_var(obj, path): ...@@ -491,7 +491,7 @@ def _save_binary_var(obj, path):
format(type(obj))) format(type(obj)))
def save(obj, path, protocol=2, **configs): def save(obj, path, protocol=4, **configs):
''' '''
Save an object to the specified path. Save an object to the specified path.
...@@ -512,7 +512,7 @@ def save(obj, path, protocol=2, **configs): ...@@ -512,7 +512,7 @@ def save(obj, path, protocol=2, **configs):
path(str) : The path of the object to be saved. path(str) : The path of the object to be saved.
If saved in the current directory, the input path string will be used as the file name. If saved in the current directory, the input path string will be used as the file name.
protocol(int, optional): The protocol version of pickle module must be greater than 1 and less than 5. protocol(int, optional): The protocol version of pickle module must be greater than 1 and less than 5.
Default: 2 Default: 4
**configs(dict, optional): optional keyword arguments. The following options are currently supported: **configs(dict, optional): optional keyword arguments. The following options are currently supported:
use_binary_format(bool): When the saved object is static graph variable, you can specify ``use_binary_for_var``. use_binary_format(bool): When the saved object is static graph variable, you can specify ``use_binary_for_var``.
If True, save the file in the c++ binary format when saving a single static graph variable; otherwise, save it in pickle format. If True, save the file in the c++ binary format when saving a single static graph variable; otherwise, save it in pickle format.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册