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

edit paddle.save/load API (#32532) (#32612)

* edit paddle.save/load API

* Update io.py

edit doc

* delete cpython-37.pyc

* Update io.py

edit doc

* Update io.py

recommit

* Update io.py

recommit

* Update io.py

recommit

* Update io.py

recommit
上级 a5627df3
......@@ -496,7 +496,7 @@ def save(obj, path, protocol=2, **configs):
Save an object to the specified path.
.. note::
Now supports saving ``state_dict`` of Layer or Optimizer, Tensor.
Now supports saving ``state_dict`` of Layer/Optimizer, Layer, Tensor and nested structure containing Tensor.
.. note::
Different from ``paddle.jit.save``, since the save result of ``paddle.save`` is a single file,
......@@ -560,7 +560,7 @@ def save(obj, path, protocol=2, **configs):
prog = paddle.static.default_main_program()
for var in prog.list_vars():
if list(var.shape) == [224, 10]:
tensor = var.get_tensor()
tensor = var.get_value()
break
# save/load tensor
......@@ -667,7 +667,7 @@ def load(path, **configs):
Load an object can be used in paddle from specified path.
.. note::
Now supports load ``state_dict`` of Layer or Optimizer, Tensor.
Now supports loading ``state_dict`` of Layer/Optimizer, Layer, Tensor and nested structure containing Tensor.
.. note::
In order to use the model parameters saved by paddle more efficiently,
......@@ -760,7 +760,7 @@ def load(path, **configs):
prog = paddle.static.default_main_program()
for var in prog.list_vars():
if list(var.shape) == [224, 10]:
tensor = var.get_tensor()
tensor = var.get_value()
break
# save/load tensor
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册