Skip to content

Commit

Permalink
edit paddle.save/load API (#32532)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
hbwx24 committed Apr 27, 2021
1 parent 1515892 commit 2b9fed2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions python/paddle/framework/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,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,
Expand Down Expand Up @@ -558,7 +558,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
Expand Down Expand Up @@ -665,7 +665,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,
Expand Down Expand Up @@ -758,7 +758,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
Expand Down
Binary file not shown.

1 comment on commit 2b9fed2

@paddle-bot-old
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Congratulation! Your pull request passed all required CI. You could ask reviewer(s) to approve and merge. 🎉

Please sign in to comment.