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

[GitHub] piiswrong closed pull request #11345: Fix save load doc

piiswrong closed pull request #11345: Fix save load doc
URL: https://github.com/apache/incubator-mxnet/pull/11345
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/python/mxnet/gluon/block.py b/python/mxnet/gluon/block.py
index 3b97c0578ca..afc034034bb 100644
--- a/python/mxnet/gluon/block.py
+++ b/python/mxnet/gluon/block.py
@@ -310,23 +310,21 @@ def _collect_params_with_prefix(self, prefix=''):
 
     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 @@ def save_params(self, filename):
 
     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 @@ def load_parameters(self, filename, ctx=None, allow_missing=False,
         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()


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services