haojin2 commented on a change in pull request #14673: [BUGFIX] fix ELU function will appear nan when calculating the gradient URL: https://github.com/apache/incubator-mxnet/pull/14673#discussion_r274779204
########## File path: python/mxnet/gluon/nn/activations.py ########## @@ -158,7 +158,8 @@ def __init__(self, alpha=1.0, **kwargs): self._alpha = alpha def hybrid_forward(self, F, x): - return F.where(x > 0, x, self._alpha * (F.exp(x) - 1.0)) + _x = F.where(x < 0, x, F.zeros_like(x)) + return F.where(x > 0, x, self._alpha * (F.exp(_x) - 1.0)) Review comment: @fierceX Yes I understand, and I'm presenting the recommended way to fix this issue to you in the above comment. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services