You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by jx...@apache.org on 2018/06/20 21:18:10 UTC

[incubator-mxnet] branch master updated: Fix save load doc (#11345)

This is an automated email from the ASF dual-hosted git repository.

jxie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git


The following commit(s) were added to refs/heads/master by this push:
     new 7aa8a0c  Fix save load doc (#11345)
7aa8a0c is described below

commit 7aa8a0c32dd6656cfc822c1fd4866f1bbe917160
Author: Anirudh Subramanian <an...@apache.org>
AuthorDate: Wed Jun 20 14:18:04 2018 -0700

    Fix save load doc (#11345)
---
 python/mxnet/gluon/block.py | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/python/mxnet/gluon/block.py b/python/mxnet/gluon/block.py
index 0845669..3dd7e94 100644
--- a/python/mxnet/gluon/block.py
+++ b/python/mxnet/gluon/block.py
@@ -310,23 +310,21 @@ class Block(object):
 
     def save_parameters(self, filename):
         """Save parameters to file.
-        This function is to be used to save parameters of a Gluon model, note that
-        the saved parameters are not meant to be loaded in a different language binding for now.
-        Saving parameters using `.save_parameters()` is different than
-        `.collect_params().save()` and `.save_params()`, which are deprecated ways
-        to save the parameters of a model and should be avoided.
-
-        If your model is hybridizable and you want to export a serialized version of the
-        structure of the model as well as its parameters please refer to
-        :py:meth:`HybridBlock.export`. Such model can then be loaded back in any language binding
-        or even in Gluon using a :py:class:`SymbolBlock`.
-        Refer to this tutorial for a complete overview of saving/loading models with
-        MXNet: https://mxnet.incubator.apache.org/tutorials/gluon/save_load_params.html
+
+        Saved parameters can only be loaded with `load_parameters`. Note that this
+        method only saves parameters, not model structure. If you want to save
+        model structures, please use :py:meth:`HybridBlock.export`.
 
         Parameters
         ----------
         filename : str
             Path to file.
+
+        References
+        ----------
+        `Saving and Loading Gluon Models
+
+        <https://mxnet.incubator.apache.org/tutorials/gluon/save_load_params.html>`_
         """
         params = self._collect_params_with_prefix()
         arg_dict = {key : val._reduce() for key, val in params.items()}
@@ -349,11 +347,7 @@ class Block(object):
 
     def load_parameters(self, filename, ctx=None, allow_missing=False,
                         ignore_extra=False):
-        """Load parameters from file.
-        This function is to be used to load parameters of a Gluon model that were
-        saved using the `.save_parameters()` function. Any other use is undefined behaviour.
-        Refer to this tutorial for a complete overview of saving/loading models with
-        MXNet: https://mxnet.incubator.apache.org/tutorials/gluon/save_load_params.html
+        """Load parameters from file previously saved by `save_parameters`.
 
         Parameters
         ----------
@@ -366,6 +360,12 @@ class Block(object):
         ignore_extra : bool, default False
             Whether to silently ignore parameters from the file that are not
             present in this Block.
+
+        References
+        ----------
+        `Saving and Loading Gluon Models
+
+        <https://mxnet.incubator.apache.org/tutorials/gluon/save_load_params.html>`_
         """
         loaded = ndarray.load(filename)
         params = self._collect_params_with_prefix()