applies an exponential linear unit function to an output formula fx alpha expx 1 for x 0 fx x for x 0 args alpha float slope of negative section defaults to 1 0 kwargs base layer keyword arguments such as name and dtype applies an exponential linear unit function to an output formula f x alpha exp x 1 for x 0 f x x for x 0 args alpha float slope of negative section defaults to 1 0 kwargs base layer keyword arguments such as name and dtype
from keras import activations
from keras.api_export import keras_export
from keras.layers.layer import Layer


@keras_export("keras.layers.ELU")
class ELU(Layer):
    

    def __init__(self, alpha=1.0, **kwargs):
        super().__init__(**kwargs)
        self.alpha = alpha
        self.supports_masking = True

    def call(self, inputs):
        return activations.elu(inputs, alpha=self.alpha)

    def compute_output_shape(self, input_shape):
        return input_shape