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


   ## Description
   When sending `mx.sym.LeakyReLU` with `slop=0.0` a `-Inf` array, it will 
output `0` in CPU but `NaN` in GPU. In contrast, LeakyRelu behaves the same on 
the `Inf` array (output `Inf` in both CPU and GPU)
   
   
   ## To Reproduce
   ```
   import os
   import mxnet as mx
   net = mx.symbol.Variable('data', shape=(0, 10,10,3))
   net = mx.sym.LeakyReLU(data=net, slope=0.0, act_type="leaky")
   mx.viz.plot_network(symbol=net)
   import numpy as np
   input_shape = (10, 10,10,3)
   x = np.random.rand(*input_shape)
   x *= -np.Inf
   e = net.bind(mx.gpu(), {'data': mx.nd.array(x,mx.gpu())})
   output_gpu = e.forward()
   print("The GPU output is: ", output_gpu)
   
   e_cpu = net.bind(mx.cpu(), {'data': mx.nd.array(x,mx.cpu())})
   output_cpu = e_cpu.forward()
   print("The CPU output is: ", output_cpu)
   ```
   
   ### Steps to reproduce
   Run above code with GPU or access the CoLab link: 
https://colab.research.google.com/drive/1jIyOFR0n8j15Yy10b1EwUKWj6v7EmJAF?usp=sharing
   
   


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

To unsubscribe, e-mail: [email protected]

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