def symmetric_elliot_function( signal, derivative=False ):
    """ A fast approximation of tanh """
    s = 1.0 # steepness
    
    abs_signal = (1 + np.abs(signal * s))
    if derivative:
        return s / abs_signal**2
    else:
        # Return the activation signal
        return (signal * s) / abs_signal
def symmetric_elliot_function ( signal , derivative = False ) : s = 1.0 abs_signal = ( 1 + np . abs ( signal * s ) ) if derivative : return s / abs_signal ** 2 else : return ( signal * s ) / abs_signal
A fast approximation of tanh