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 2020/09/01 01:13:51 UTC

[GitHub] [incubator-mxnet] leezu commented on a change in pull request #17970: fix block.export

leezu commented on a change in pull request #17970:
URL: https://github.com/apache/incubator-mxnet/pull/17970#discussion_r480536470



##########
File path: python/mxnet/gluon/block.py
##########
@@ -1348,8 +1348,17 @@ def export(self, path, epoch=0, remove_amp_cast=True):
                 if name in arg_names:
                     arg_dict['arg:{}'.format(name)] = param._reduce()
                 else:
-                    assert name in aux_names
-                    arg_dict['aux:{}'.format(name)] = param._reduce()
+                    if name.endswith('running_mean') or name.endswith('running_var') \
+                        or name.endswith('moving_mean') or name.endswith('moving_var'):
+                        if name not in aux_names:
+                            warnings.warn('Parameter "{name}" is not found in '
+                                          'the graph. '
+                                          .format(name=name), stacklevel=3)
+                    else:
+                        warnings.warn('Parameter "{name}" is not found in '
+                                      'the graph. '
+                                      .format(name=name), stacklevel=3)
+                    arg_dict['aux:%s'%name] = param._reduce()

Review comment:
       Why not
   
   ```suggestion
                       if name not in aux_names:
                           warnings.warn('Parameter "{name}" is not found in the graph. '
                                         .format(name=name), stacklevel=3)
                       else:
                           arg_dict['aux:%s'%name] = param._reduce()
   ```




----------------------------------------------------------------
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:
users@infra.apache.org