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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to