reminisce commented on a change in pull request #16621: [Numpy] Basic indexing 
in symbolic interface of DeepNumpy
URL: https://github.com/apache/incubator-mxnet/pull/16621#discussion_r350470836
 
 

 ##########
 File path: python/mxnet/symbol/numpy/_symbol.py
 ##########
 @@ -4957,4 +5119,62 @@ def where(condition, x, y):
     return _npi.where(condition, x, y, out=None)
 
 
+@set_module('mxnet.symbol.numpy')
+def load_json_string(json_str):
+    """
+    Loads symbol from json string.
+
+    Parameters
+    ----------
+    json_str : str
+        A JSON string.
+
+    Returns
+    -------
+    sym : Symbol
+        The loaded symbol.
+
+    See Also
+    --------
+    _Symbol.tojson : Used to save symbol into json string.
+    """
+    if not isinstance(json_str, string_types):
+        raise TypeError('fname required to be string')
+    handle = SymbolHandle()
+    json_data = json.loads(json_str)
+    check_call(_LIB.MXSymbolCreateFromJSON(c_str(json.dumps(json_data)), 
ctypes.byref(handle)))
+    s = _Symbol(handle)
+    return s
+
+
+@set_module('mxnet.symbol.numpy')
+def load(fname):
+    """Loads symbol from a JSON file.
+    You can also use pickle to do the job if you only work on python.
+    The advantage of load/save is the file is language agnostic.
+    This means the file saved using save can be loaded by other language 
binding of mxnet.
+    You also get the benefit being able to directly load/save from cloud 
storage(S3, HDFS).
+    Parameters
+    ----------
+    fname : str
+        The name of the file, examples:
+        - `s3://my-bucket/path/my-s3-symbol`
+        - `hdfs://my-bucket/path/my-hdfs-symbol`
+        - `/path-to/my-local-symbol`
+    Returns
+    -------
+    sym : Symbol
+        The loaded symbol.
+    See Also
+    --------
+    Symbol.save : Used to save symbol into file.
+    """
+    if not isinstance(fname, string_types):
 
 Review comment:
   Reuse `mx.sym.load`?

----------------------------------------------------------------
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]


With regards,
Apache Git Services

Reply via email to