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/11/09 23:38:29 UTC

[GitHub] [incubator-mxnet] leezu commented on a change in pull request #19417: NumPy compatible serialization API

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



##########
File path: docs/python_docs/python/tutorials/packages/np/np-vs-numpy.md
##########
@@ -91,16 +91,20 @@ b = a[0]
 b.ndim, b.size, isinstance(b, np.ndarray)
 ```
 
-## Save
+## Save and load
 
-The `save` method in `mxnet.np` saves data into a binary format that's not compatible with NumPy format. For example, it contains the device information. (TODO, needs more discussion here.) 
+Users should call the official NumPy `save` and `load` methods respectively to save and load arrays.
 
 ```{.python .input}
 a = np.array(1, ctx=gpu)
-npx.save('a', a)
-npx.load('a')
+onp.save('a', a)
+onp.load('a.npy', a)
 ```
 
+For advanced use-cases, MXNet further provides `npx.save` and `npx.load`, which
+can save and load a dictionary of arrays to the `.npz` format such that it can

Review comment:
       Added `npx.savez` that can save multiple arrays (dense or sparse) to the npz format. Updated `npx.save` to only support saving a single dense array to `.npy`.
   
   I'm keeping them in the `npx` namespace as we do not support pickling objects etc.
   
   WDYT?




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