Skip to content

Commit 25588a3

Browse files
authored
Merge pull request #5033 from pengli09/add-a-warning
Add a warning to the docstring of Parameters.to_tar()
2 parents 630644e + 4098a03 commit 25588a3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

python/paddle/v2/parameters.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,17 @@ def deserialize(self, name, f):
326326
self.set(name, arr.reshape(self.get_shape(name)))
327327

328328
def to_tar(self, f):
329+
"""
330+
Save parameters to a tar file.
331+
332+
WARNING: You should use `paddle.v2.trainer.SGD.save_parameter_to_tar(f)`
333+
to save parameters most of the time. Otherwise, some settings such
334+
as model average will not take effect.
335+
336+
:param f:
337+
:type f: file
338+
:return:
339+
"""
329340
tar = tarfile.TarFile(fileobj=f, mode='w')
330341
for nm in self.names():
331342
buf = cStringIO.StringIO()

0 commit comments

Comments
 (0)