提交 25588a38 编写于 作者: P Peng LI 提交者: GitHub

Merge pull request #5033 from pengli09/add-a-warning

Add a warning to the docstring of Parameters.to_tar()
...@@ -326,6 +326,17 @@ class Parameters(object): ...@@ -326,6 +326,17 @@ class Parameters(object):
self.set(name, arr.reshape(self.get_shape(name))) self.set(name, arr.reshape(self.get_shape(name)))
def to_tar(self, f): def to_tar(self, f):
"""
Save parameters to a tar file.
WARNING: You should use `paddle.v2.trainer.SGD.save_parameter_to_tar(f)`
to save parameters most of the time. Otherwise, some settings such
as model average will not take effect.
:param f:
:type f: file
:return:
"""
tar = tarfile.TarFile(fileobj=f, mode='w') tar = tarfile.TarFile(fileobj=f, mode='w')
for nm in self.names(): for nm in self.names():
buf = cStringIO.StringIO() buf = cStringIO.StringIO()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册