leezu commented on a change in pull request #17970:
URL: https://github.com/apache/incubator-mxnet/pull/17970#discussion_r471803400
##########
File path: python/mxnet/gluon/block.py
##########
@@ -1248,7 +1248,11 @@ def export(self, path, epoch=0, remove_amp_cast=True):
will be created, where xxxx is the 4 digits epoch number.
epoch : int
Epoch number of saved model.
-
+ remove_amp_cast : bool, optional
+ Whether to remove the amp_cast and amp_multicast operators, before
exporting the model.
+ allow_extra : bool, optional
+ Whether to save extra parameters whose names are not in the result
symbol.
+ User can set allow_extra to True to load these parameters with old
mxnet.mod.Module.set_params API.
Review comment:
`mxnet.mod.Module.set_params` does not exist anymore.
##########
File path: python/mxnet/gluon/block.py
##########
@@ -1248,7 +1248,11 @@ def export(self, path, epoch=0, remove_amp_cast=True):
will be created, where xxxx is the 4 digits epoch number.
epoch : int
Epoch number of saved model.
-
+ remove_amp_cast : bool, optional
+ Whether to remove the amp_cast and amp_multicast operators, before
exporting the model.
+ allow_extra : bool, optional
Review comment:
What is the use-case to save parameters that are not used by the symbol?
Do we need this option?
##########
File path: python/mxnet/gluon/block.py
##########
@@ -1271,8 +1275,13 @@ def export(self, path, epoch=0, remove_amp_cast=True):
if name in arg_names:
arg_dict['arg:%s'%name] = param._reduce()
else:
- assert name in aux_names
- arg_dict['aux:%s'%name] = param._reduce()
+ if name.endswith('running_mean') or
name.endswith('running_var') \
+ or name.endswith('moving_mean') or
name.endswith('moving_var'):
+ assert name in aux_names
+ arg_dict['aux:%s'%name] = param._reduce()
Review comment:
Where do we ensure that no aux parameter with a name different to
`running_mean`, `running_var`, etc is missing from the resulting params file?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]