tf.keras.ops.sigmoid

Sigmoid activation function.

It is defined as f(x) = 1 / (1 + exp(-x)).

x Input tensor.

A tensor with the same shape as x.

Example:

x = keras.ops.convert_to_tensor([-6.0, 1.0, 0.0, 1.0, 6.0])
keras.ops.sigmoid(x)
array([0.00247262, 0.7310586, 0.5, 0.7310586, 0.9975274], dtype=float32)