Class Sigmoid
java.lang.Object
org.tensorflow.framework.activations.AbstractActivation
org.tensorflow.framework.activations.Sigmoid
- All Implemented Interfaces:
Activation
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]
-
Field Summary
FieldsFields inherited from class AbstractActivation
NAME_KEY, tf -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the calculation operation for the activation.Gets a configuration mapgetName()Get the name of the activation as known by the TensorFlow EngineApplies the Sigmoid activation function,sigmoid(x) = 1 / (1 + exp(-x)).Methods inherited from class AbstractActivation
checkClassName, checkConfigKeys, getDefaultConfig, getTF, setTF
-
Field Details
-
NAME
-
-
Constructor Details
-
Sigmoid
public Sigmoid()Creates a Sigmoid activation. -
Sigmoid
Creates a new Exponential from a configuration Map- Parameters:
config- the configuration map, this class does not use any of the entries in the configuration map- Throws:
IllegalArgumentException- if the configuration contains unsupported keys for this class or if the value for the name key does not match the name for the Activation
-
-
Method Details
-
sigmoid
Applies the Sigmoid activation function,sigmoid(x) = 1 / (1 + exp(-x)).Example Usage:
Operand<TFloat32> input = ...; Operand<TFloat32> result = Sigmoid.sigmoid(tf, input);- Type Parameters:
T- the data type for the input- Parameters:
tf- the TensorFlow Opsinput- the input- Returns:
- the input, unmodified.
-
call
-
getConfig
Gets a configuration map- Specified by:
getConfigin classAbstractActivation- Returns:
- the configuration map
-
getName
Get the name of the activation as known by the TensorFlow Engine- Specified by:
getNamein classAbstractActivation- Returns:
- the name of the activation as known by the TensorFlow Engine
-