From e89fb253cf3f649d2d3868b8f929b5ae2b8e5195 Mon Sep 17 00:00:00 2001 From: WeiXin Date: Fri, 14 May 2021 18:52:24 +0800 Subject: [PATCH] Set the default value of protocol to 4. (#32904) --- python/paddle/fluid/io.py | 4 ++-- python/paddle/framework/io.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/python/paddle/fluid/io.py b/python/paddle/fluid/io.py index 30baa2aa26..30a0b4053e 100644 --- a/python/paddle/fluid/io.py +++ b/python/paddle/fluid/io.py @@ -1788,7 +1788,7 @@ def _legacy_save(param_dict, model_path, protocol=2): @static_only -def save(program, model_path, protocol=2, **configs): +def save(program, model_path, protocol=4, **configs): """ :api_attr: Static Graph @@ -1802,7 +1802,7 @@ def save(program, model_path, protocol=2, **configs): 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 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. Returns: diff --git a/python/paddle/framework/io.py b/python/paddle/framework/io.py index de2116cd43..1705db50d3 100644 --- a/python/paddle/framework/io.py +++ b/python/paddle/framework/io.py @@ -491,7 +491,7 @@ def _save_binary_var(obj, path): format(type(obj))) -def save(obj, path, protocol=2, **configs): +def save(obj, path, protocol=4, **configs): ''' Save an object to the specified path. @@ -512,7 +512,7 @@ def save(obj, path, protocol=2, **configs): 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. 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: 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. -- GitLab