hard_sigmoid

dragon.vm.tensorflow.keras.activations.hard_sigmoid(
  x,
  **kwargs
)[source]

Apply the hard sigmoid function to input.

The HardSigmoid function is defined as:

\[\text{HardSigmoid}(x) = \max(0, \min(1, 0.2 * x + 0.5)) \]

Examples:

x = tf.constant([-2.5, -1.0, 0.0, 1.0, 2.5])
print(tf.keras.activations.hard_sigmoid(x, inplace=False))
Parameters:
Returns:

dragon.Tensor – The output tensor.