tf.keras.ops.squareplus

Squareplus activation function.

The Squareplus activation function is defined as:

f(x) = (x + sqrt(x^2 + b)) / 2

x Input tensor.
b Smoothness parameter. Defaults to 4.

A tensor with the same shape as x.

Example:

x = np.array([-1.0, 0.0, 1.0])
x_squareplus = keras.ops.squareplus(x)
print(x_squareplus)
array([0.6180, 1.0000, 1.6180], dtype=float32)