leezu commented on a change in pull request #19220:
URL: https://github.com/apache/incubator-mxnet/pull/19220#discussion_r494688660
##########
File path: python/mxnet/gluon/block.py
##########
@@ -1355,9 +1359,18 @@ def export(self, path, epoch=0, remove_amp_cast=True):
else:
arg_dict['aux:%s'%name] = param._reduce()
save_fn = _mx_npx.save if is_np_array() else ndarray.save
- params_filename = '%s-%04d.params'%(path, epoch)
- save_fn(params_filename, arg_dict)
- return (sym_filename, params_filename)
Review comment:
Do you mean remove the `aux:` and `arg:` prefixes. I'm fine with that
##########
File path: python/mxnet/gluon/block.py
##########
@@ -1355,9 +1359,18 @@ def export(self, path, epoch=0, remove_amp_cast=True):
else:
arg_dict['aux:%s'%name] = param._reduce()
save_fn = _mx_npx.save if is_np_array() else ndarray.save
- params_filename = '%s-%04d.params'%(path, epoch)
- save_fn(params_filename, arg_dict)
- return (sym_filename, params_filename)
+ params_filename = '%s-%04d.params'%((path if path is not None else
""), epoch)
+
+ if path is not None:
+ save_fn(params_filename, arg_dict)
+ return (sym_filename, params_filename)
+
+ if remove_amp_cast:
+ handle = SymbolHandle()
+ import ctypes
+ check_call(_LIB.MXSymbolRemoveAmpCast(sym.handle,
ctypes.byref(handle)))
+ sym = type(sym)(handle)
+ return sym, arg_dict
Review comment:
`arg_dict` here contains aux as well
##########
File path: python/mxnet/gluon/block.py
##########
@@ -1355,9 +1359,18 @@ def export(self, path, epoch=0, remove_amp_cast=True):
else:
arg_dict['aux:%s'%name] = param._reduce()
save_fn = _mx_npx.save if is_np_array() else ndarray.save
- params_filename = '%s-%04d.params'%(path, epoch)
- save_fn(params_filename, arg_dict)
- return (sym_filename, params_filename)
Review comment:
I think it can still be useful, for example to print the filenames.
----------------------------------------------------------------
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]