def my_better_softplus(z): return tf.where(z > 30., z, tf.math.log(tf.exp(z) + 1.)) #return tf.where(z > 15, z, tf.math.log(z)) x = tf.Variable([89.])