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/08/13 19:04:05 UTC

[GitHub] [incubator-mxnet] rogerdettloff opened a new issue #18918: Export/imports doesn't work with npx.set_np()

rogerdettloff opened a new issue #18918:
URL: https://github.com/apache/incubator-mxnet/issues/18918


   ## Description
   When using npx.set_np(), I create a net (model), save it using `net.export()`, later re-load it using `mx.gluon.SymbolBlock.imports()`.  I get an error as show below...  
   
   ### Error Message
   ```
   Traceback (most recent call last):
     File "<input>", line 2, in <module>
     File "D:\Projects\Combinati\dPCR-analysis\env-mxnet\lib\site-packages\mxnet\gluon\block.py", line 698, in __call__
       _check_all_np_ndarrays(out)
     File "D:\Projects\Combinati\dPCR-analysis\env-mxnet\lib\site-packages\mxnet\gluon\utils.py", line 489, in _check_all_np_ndarrays
       .format(str(type(out))))
   TypeError: Block's output ndarrays/symbols must be of type `mxnet.numpy.ndarray` or `mxnet.symbol.numpy._Symbol`, while got output type <class 'mxnet.ndarray.ndarray.NDArray'>
   
   ```
   ## To Reproduce
   This works when NOT using npx.use_np()...posting it as a reference.
   ```
   import mxnet as mx
   # create a simple net...
   net1 = mx.gluon.nn.HybridSequential()
   net1.add(mx.gluon.nn.Dense(64, activation='relu'))
   net1.add(mx.gluon.nn.Dense(2))
   net1.hybridize()
   net1.collect_params().initialize(mx.init.Xavier())
   x = mx.nd.random.normal(shape=(1, 64))
   out1 = net1(x)
   net1.export('net1', epoch=1)
   
   net2 = mx.gluon.SymbolBlock.imports('net1-symbol.json', ['data'], 'net1-0001.params')
   out2 = net2(x)
   ```
   
   Now try the same thing with `npx.use_np()` , and we get the error.
   ```
   import mxnet as mx
   from mxnet import np, npx
   npx.set_np()
   net1 = mx.gluon.nn.HybridSequential()
   net1.add(mx.gluon.nn.Dense(64, activation='relu'))
   net1.add(mx.gluon.nn.Dense(2))
   net1.hybridize()
   net1.collect_params().initialize(mx.init.Xavier())
   x = mx.np.random.normal(size=(1,64))
   out1 = net1(x)
   
   net2 = mx.gluon.SymbolBlock.imports('net1-symbol.json', ['data'], 'net1-0001.params')
   out2 = net2(x)
   
   Traceback (most recent call last):
     File "<input>", line 2, in <module>
     File "D:\Projects\Combinati\dPCR-analysis\env-mxnet\lib\site-packages\mxnet\gluon\block.py", line 698, in __call__
       _check_all_np_ndarrays(out)
     File "D:\Projects\Combinati\dPCR-analysis\env-mxnet\lib\site-packages\mxnet\gluon\utils.py", line 489, in _check_all_np_ndarrays
       .format(str(type(out))))
   TypeError: Block's output ndarrays/symbols must be of type `mxnet.numpy.ndarray` or `mxnet.symbol.numpy._Symbol`, while got output type <class 'mxnet.ndarray.ndarray.NDArray'>
   
   ```
   
   ## Environment
   
   We recommend using our script for collecting the diagnositc information. Run the following command and paste the outputs below:
   ```
   ----------Python Info----------
   Version      : 3.7.6
   Compiler     : MSC v.1916 64 bit (AMD64)
   Build        : ('tags/v3.7.6:43364a7ae0', 'Dec 19 2019 00:42:30')
   Arch         : ('64bit', 'WindowsPE')
   ------------Pip Info-----------
   Version      : 20.2.1
   Directory    : D:\Projects\Combinati\dPCR-analysis\env-mxnet\lib\site-packages\pip
   ----------MXNet Info-----------
   Version      : 1.6.0
   Directory    : D:\Projects\Combinati\dPCR-analysis\env-mxnet\lib\site-packages\mxnet
   Num GPUs     : 0
   Hashtag not found. Not installed from pre-built package.
   ----------System Info----------
   Platform     : Windows-10-10.0.18362-SP0
   system       : Windows
   node         : roger-5577
   release      : 10
   version      : 10.0.18362
   ----------Hardware Info----------
   machine      : AMD64
   processor    : Intel64 Family 6 Model 158 Stepping 9, GenuineIntel
   Name                                       
   Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz  
   
   ```
   


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



[GitHub] [incubator-mxnet] leezu commented on issue #18918: Export/imports doesn't work with npx.set_np()

Posted by GitBox <gi...@apache.org>.
leezu commented on issue #18918:
URL: https://github.com/apache/incubator-mxnet/issues/18918#issuecomment-673716617


   Let's track the bug for the 1.x branch, in case someone is interested in improving the np support there


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



[GitHub] [incubator-mxnet] sxjscience closed issue #18918: Export/imports doesn't work with npx.set_np()

Posted by GitBox <gi...@apache.org>.
sxjscience closed issue #18918:
URL: https://github.com/apache/incubator-mxnet/issues/18918


   


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



[GitHub] [incubator-mxnet] sxjscience commented on issue #18918: Export/imports doesn't work with npx.set_np()

Posted by GitBox <gi...@apache.org>.
sxjscience commented on issue #18918:
URL: https://github.com/apache/incubator-mxnet/issues/18918#issuecomment-673699686


   @rogerdettloff Actually I cannot reproduce this, would you try to install the nightly version of MXNet and try again?
   
   To install the nightly version:
   
   ```bash
   # Install the version with CUDA 10.0
   python3 -m pip install -U --pre "mxnet-cu100>=2.0.0b20200802" -f https://dist.mxnet.io/python
   
   # Install the version with CUDA 10.1
   python3 -m pip install -U --pre "mxnet-cu101>=2.0.0b20200802" -f https://dist.mxnet.io/python
   
   # Install the version with CUDA 10.2
   python3 -m pip install -U --pre "mxnet-cu102>=2.0.0b20200802" -f https://dist.mxnet.io/python
   
   # Install the cpu-only version
   python3 -m pip install -U --pre "mxnet>=2.0.0b20200802" -f https://dist.mxnet.io/python
   
   ```
   
   ```python
   import mxnet as mx
   from mxnet import np, npx
   npx.set_np()
   net1 = mx.gluon.nn.HybridSequential()
   net1.add(mx.gluon.nn.Dense(64, activation='relu'))
   net1.add(mx.gluon.nn.Dense(2))
   net1.hybridize()
   net1.initialize(mx.init.Xavier())
   x = mx.np.random.normal(size=(1,64))
   out1 = net1(x)
   net1.export('net1', epoch=1)
   
   
   net2 = mx.gluon.SymbolBlock.imports('net1-symbol.json', ['data'], 'net1-0001.params')
   out2 = net2(x)
   print(out2)
   ```


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



[GitHub] [incubator-mxnet] sxjscience commented on issue #18918: Export/imports doesn't work with npx.set_np()

Posted by GitBox <gi...@apache.org>.
sxjscience commented on issue #18918:
URL: https://github.com/apache/incubator-mxnet/issues/18918#issuecomment-673700963


   @rogerdettloff I closed it by mistake, feel free to respond to this thread if you have further findings.


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



[GitHub] [incubator-mxnet] rogerdettloff closed issue #18918: Export/imports doesn't work with npx.set_np()

Posted by GitBox <gi...@apache.org>.
rogerdettloff closed issue #18918:
URL: https://github.com/apache/incubator-mxnet/issues/18918


   


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



[GitHub] [incubator-mxnet] szha commented on issue #18918: Export/imports doesn't work with npx.set_np()

Posted by GitBox <gi...@apache.org>.
szha commented on issue #18918:
URL: https://github.com/apache/incubator-mxnet/issues/18918#issuecomment-673657917


   cc @leezu 


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



[GitHub] [incubator-mxnet] rogerdettloff commented on issue #18918: Export/imports doesn't work with npx.set_np()

Posted by GitBox <gi...@apache.org>.
rogerdettloff commented on issue #18918:
URL: https://github.com/apache/incubator-mxnet/issues/18918#issuecomment-673715516


   I just confirmed this is fixed in 2.0.  Thanks.


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