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 4988535  add epoch parameter to export() of HybridBlock (#9290)
4988535 is described below

commit 4988535bb6361b83dd82d72c798129ed808c508e
Author: Wei Wu <[email protected]>
AuthorDate: Fri Jan 5 03:15:02 2018 +0800

    add epoch parameter to export() of HybridBlock (#9290)
    
    * add epoch parameter to export() of HybridBlock
    
    * update function Comments of export()
---
 python/mxnet/gluon/block.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/python/mxnet/gluon/block.py b/python/mxnet/gluon/block.py
index 37734ac..0d49def 100644
--- a/python/mxnet/gluon/block.py
+++ b/python/mxnet/gluon/block.py
@@ -470,7 +470,7 @@ class HybridBlock(Block):
         """Infers data type of Parameters from inputs."""
         self._infer_attrs('infer_type', 'dtype', *args)
 
-    def export(self, path):
+    def export(self, path, epoch=0):
         """Export HybridBlock to json format that can be loaded by 
`mxnet.mod.Module`
         or the C++ interface.
 
@@ -480,8 +480,10 @@ class HybridBlock(Block):
         Parameters
         ----------
         path : str
-            Path to save model. Two files `path-symbol.json` and 
`path-0000.params`
-            will be created.
+            Path to save model. Two files `path-symbol.json` and 
`path-xxxx.params`
+            will be created, where xxxx is the 4 digits epoch number.
+        epoch : int
+            Epoch number of saved model.
         """
         if not self._cached_graph:
             raise RuntimeError(
@@ -499,7 +501,7 @@ class HybridBlock(Block):
             else:
                 assert name in aux_names
                 arg_dict['aux:%s'%name] = param._reduce()
-        ndarray.save('%s-0000.params'%path, arg_dict)
+        ndarray.save('%s-%04d.params'%(path, epoch), arg_dict)
 
     def forward(self, x, *args):
         """Defines the forward computation. Arguments can be either

-- 
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].

Reply via email to