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

edit paddle.save/load API (#32532)

* 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
上级 797b2dfd
...@@ -494,7 +494,7 @@ def save(obj, path, protocol=2, **configs): ...@@ -494,7 +494,7 @@ def save(obj, path, protocol=2, **configs):
Save an object to the specified path. Save an object to the specified path.
.. note:: .. 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:: .. note::
Different from ``paddle.jit.save``, since the save result of ``paddle.save`` is a single file, Different from ``paddle.jit.save``, since the save result of ``paddle.save`` is a single file,
...@@ -558,7 +558,7 @@ def save(obj, path, protocol=2, **configs): ...@@ -558,7 +558,7 @@ def save(obj, path, protocol=2, **configs):
prog = paddle.static.default_main_program() prog = paddle.static.default_main_program()
for var in prog.list_vars(): for var in prog.list_vars():
if list(var.shape) == [224, 10]: if list(var.shape) == [224, 10]:
tensor = var.get_tensor() tensor = var.get_value()
break break
# save/load tensor # save/load tensor
...@@ -665,7 +665,7 @@ def load(path, **configs): ...@@ -665,7 +665,7 @@ def load(path, **configs):
Load an object can be used in paddle from specified path. Load an object can be used in paddle from specified path.
.. note:: .. 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:: .. note::
In order to use the model parameters saved by paddle more efficiently, In order to use the model parameters saved by paddle more efficiently,
...@@ -758,7 +758,7 @@ def load(path, **configs): ...@@ -758,7 +758,7 @@ def load(path, **configs):
prog = paddle.static.default_main_program() prog = paddle.static.default_main_program()
for var in prog.list_vars(): for var in prog.list_vars():
if list(var.shape) == [224, 10]: if list(var.shape) == [224, 10]:
tensor = var.get_tensor() tensor = var.get_value()
break break
# save/load tensor # save/load tensor
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册