Sigmoid

public class Sigmoid

Sigmoid activation. sigmoid(x) = 1 / (1 + exp(-x)).

Applies the sigmoid activation function. For small values (<-5), sigmoid returns a value close to zero, and for large values (>5) the result of the function gets close to 1.

Sigmoid is equivalent to a 2-element Softmax, where the second element is assumed to be zero. The sigmoid function always returns a value between 0 and 1.

For example:

     Operand<TFloat32> input = tf.constant(
              new float[] {-20f, -1.0f, 0.0f, 1.0f, 20f});
     Sigmoid<TFloat32> sigmoid = new Sigmoid<>(tf);
     Operand<TFloat32> result = sigmoid.call(input);
     // result is [2.0611537e-09f, 2.6894143e-01f,
     //                 5.0000000e-01f,7.3105860e-01f, 1.f]
 

Public Constructors

Sigmoid(Ops tf)
Creates a Sigmoid activation.

Public Methods

Operand<T>
call(Operand<T> input)
Gets the calculation operation for the activation.

Inherited Methods

Public Constructors

public Sigmoid (Ops tf)

Creates a Sigmoid activation.

Parameters
tf the TensorFlow Ops

Public Methods

public Operand<T> call (Operand<T> input)

Gets the calculation operation for the activation.

Parameters
input the input tensor
Returns
  • The operand for the activation