diff options
author | Francois Chollet <fchollet@google.com> | 2018-09-13 18:19:50 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-09-13 18:27:33 -0700 |
commit | eb5cd6926ef8d2a5a748f1aa978e51148e22dd97 (patch) | |
tree | b2e23509fe93aaa7391850b9c32928344e1d0779 /tensorflow/python/keras/backend.py | |
parent | 2e11d827d656a671757d386881e925c97f0b3d9c (diff) |
Make Keras relu use nn.leaky_relu when appropriate.
PiperOrigin-RevId: 212912615
Diffstat (limited to 'tensorflow/python/keras/backend.py')
-rw-r--r-- | tensorflow/python/keras/backend.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tensorflow/python/keras/backend.py b/tensorflow/python/keras/backend.py index 529b07dc12..6f766c6257 100644 --- a/tensorflow/python/keras/backend.py +++ b/tensorflow/python/keras/backend.py @@ -3462,6 +3462,9 @@ def relu(x, alpha=0., max_value=None, threshold=0): clip_max = max_value is not None if alpha != 0.: + if max_value is None and threshold == 0: + return nn.leaky_relu(x, alpha=alpha) + if threshold != 0: negative_part = nn.relu(-x + threshold) else: |