This is an automated email from the ASF dual-hosted git repository. wkcn 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 9c10ed4 update symbol to json (#16948) 9c10ed4 is described below commit 9c10ed4c33f88fb27a1eca112bbd6bc5a6e3b1f9 Author: chinakook <chinak...@msn.com> AuthorDate: Sun Feb 16 23:57:02 2020 +0800 update symbol to json (#16948) * update symbol to json add remove_amp_cast argument to keep same with symbol.save * retrigger CI Co-authored-by: JackieWu <w...@live.cn> --- python/mxnet/symbol/symbol.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/python/mxnet/symbol/symbol.py b/python/mxnet/symbol/symbol.py index 6d9bf04..a4599c8 100644 --- a/python/mxnet/symbol/symbol.py +++ b/python/mxnet/symbol/symbol.py @@ -1364,7 +1364,7 @@ class Symbol(SymbolBase): else: check_call(_LIB.MXSymbolSaveToFile(self.handle, c_str(fname))) - def tojson(self): + def tojson(self, remove_amp_cast=True): """Saves symbol to a JSON string. See Also @@ -1372,7 +1372,12 @@ class Symbol(SymbolBase): symbol.load_json : Used to load symbol from JSON string. """ json_str = ctypes.c_char_p() - check_call(_LIB.MXSymbolSaveToJSON(self.handle, ctypes.byref(json_str))) + if remove_amp_cast: + handle = SymbolHandle() + check_call(_LIB.MXSymbolRemoveAmpCast(self.handle, ctypes.byref(handle))) + check_call(_LIB.MXSymbolSaveToJSON(handle, ctypes.byref(json_str))) + else: + check_call(_LIB.MXSymbolSaveToJSON(self.handle, ctypes.byref(json_str))) return py_str(json_str.value) @staticmethod