Skip to content

Instantly share code, notes, and snippets.

@oborchers
Last active May 23, 2019 08:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oborchers/2732decb2b1cfd878ce14df0bfd76a30 to your computer and use it in GitHub Desktop.
Save oborchers/2732decb2b1cfd878ce14df0bfd76a30 to your computer and use it in GitHub Desktop.
Computes the Non-Negative Exponential Linear Unit
import tensorflow as tf
def nnelu(input):
""" Computes the Non-Negative Exponential Linear Unit
"""
return tf.add(tf.constant(1, dtype=tf.float32), tf.nn.elu(input))
tf.keras.utils.get_custom_objects().update({'nnelu': Activation(nnelu)})
@rodvei
Copy link

rodvei commented May 23, 2019

If mdn_nnelu.py is used without the rest of the code, than Activation is not defined. You can use "tf.keras.layers.Activation(nnelu)" or "from tf.keras.layers import Activation" instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment