You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mxnet.apache.org by GitBox <gi...@apache.org> on 2020/09/11 08:04:56 UTC

[GitHub] [incubator-mxnet] sxjscience opened a new issue #19118: [Bug][Numpy] MXNet fp16 initialization bug

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


   ```python
   import mxnet as mx
   mx.npx.set_np()
   net = mx.gluon.nn.Dense(16, in_units=16,)
   net.initialize(ctx=mx.gpu())
   net.hybridize()
   net(mx.np.random.normal(0, 1, (16, 16), dtype=mx.np.float16, ctx=mx.gpu()))
   ```
   
   Error:
   ```
   MXNetError: MXNetError: Error in operator dense_fwd: [08:01:49] ../src/io/../operator/elemwise_op_common.h:135: Check failed: assign(&dattr, vec.at(i)): Incompatible attr in node dense_fwd at 1-th input: expected float16, got float32
   
   ```
   
   Root cause:
   https://github.com/apache/incubator-mxnet/blob/fb73de7582de4e622299a4ad045e25f771568193/python/mxnet/initializer.py#L510
   
   This should be changed to `uniform_fn(-self.scale, self.scale, arr.shape, dtype=arr.dtype, out=arr)`
   
   @mk-61 This should also be related to AMP.
   


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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] sxjscience closed issue #19118: [Bug][Numpy] MXNet fp16 initialization bug

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


   


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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] kohillyang commented on issue #19118: [Bug][Numpy] MXNet fp16 initialization bug

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


   I think the following line should be added to convert the model to FP16.
   ```bash
   net = net.cast("float16")
   ```
   


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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] sxjscience commented on issue #19118: [Bug][Numpy] MXNet fp16 initialization bug

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


   Thanks for the contribution @AnshuTrivedi . You may try to fix the initializers and add a test case in https://github.com/apache/incubator-mxnet/blob/master/tests/python/unittest/test_numpy_gluon.py


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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] kohillyang commented on issue #19118: [Bug][Numpy] MXNet fp16 initialization bug

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






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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] sxjscience commented on issue #19118: [Bug][Numpy] MXNet fp16 initialization bug

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


   @kohillyang Sorry that I forgot the past the `cast` call when creating the issue, updated the code.


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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] sxjscience commented on issue #19118: [Bug][Numpy] MXNet fp16 initialization bug

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


   
   Forgot to add the `cast` in the example. The error I met is as follows:
   
   ```python
   import mxnet as mx
   mx.npx.set_np()
   net = mx.gluon.nn.Dense(16, in_units=16)
   net.cast("float16")
   net.initialize(ctx=mx.gpu())
   net.hybridize()
   net(mx.np.random.normal(0, 1, (16, 16), dtype=mx.np.float16, ctx=mx.gpu()))
   ```
   
   Error:
   ```
   MXNetError: Traceback (most recent call last):
     File "../src/imperative/./imperative_utils.h", line 306
   MXNetError: Check failed: outputs[i]->dtype() == out_types[i] (2 vs. 0) : 0-th output has invalid dtype. Expecting 0 got 2 in operator _npi_uniform
   ```


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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] sxjscience commented on issue #19118: [Bug][Numpy] MXNet fp16 initialization bug

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






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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] AnshuTrivedi commented on issue #19118: [Bug][Numpy] MXNet fp16 initialization bug

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


   Hi @sxjscience I want to fix this issue. Please assign me. 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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] sxjscience commented on issue #19118: [Bug][Numpy] MXNet fp16 initialization bug

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


   Thanks @AnshuTrivedi and @szha . This is now closed.


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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] sxjscience commented on issue #19118: [Bug][Numpy] MXNet fp16 initialization bug

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






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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] AnshuTrivedi commented on issue #19118: [Bug][Numpy] MXNet fp16 initialization bug

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


   @sxjscience i'm facing difficulty in [test_numpy_gluon](https://github.com/apache/incubator-mxnet/blob/2d3ce934f8ef95940744a84c24ba389bf307bb5a/tests/python/unittest/test_numpy_gluon.py#L66).
   I think test is writen ,what changes have to make there?
   Please help me.


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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] kohillyang commented on issue #19118: [Bug][Numpy] MXNet fp16 initialization bug

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


   I think the following line should be added to convert the model to FP16.
   ```bash
   net = net.cast("float16")
   ```
   


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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] kohillyang commented on issue #19118: [Bug][Numpy] MXNet fp16 initialization bug

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






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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org