Class Swish
java.lang.Object
org.tensorflow.framework.activations.AbstractActivation
org.tensorflow.framework.activations.Swish
- All Implemented Interfaces:
Activation
Swish activation function.
swish(x) = x * sigmoid(x).
Swish activation function which returns x*sigmoid(x). It is a smooth, non-monotonic
function that consistently matches or outperforms ReLU on deep networks, it is unbounded
above and bounded below.
Example Usage:
Operand<TFloat32> input = tf.constant(new float[]
{-20, -1.0, 0.0, 1.0, 20});
Swish<TFloat32> swish = new Swish<>(tf);
Operand<TFloat32> result = swish.call(input);
// result = [-4.1223075e-08f, -2.6894143e-01f, 0.0000000e+00f,
// 7.3105860e-01f, 2.0000000e+01f ]
- See Also:
-
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 Swish activation function,swish(x) = x * sigmoid(x).Methods inherited from class AbstractActivation
checkClassName, checkConfigKeys, getDefaultConfig, getTF, setTF
-
Field Details
-
NAME
-
-
Constructor Details
-
Swish
public Swish()Creates a Swish activation,swish(x) = x * sigmoid(x).Swish activation function which returns
x*sigmoid(x). It is a smooth, non-monotonic function that consistently matches or outperforms ReLU on deep networks, it is unbounded above and bounded below. -
Swish
Creates a new Swish 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
-
swish
Applies the Swish activation function,swish(x) = x * sigmoid(x).Example Usage:
Operand<TFloat32> input = ...; Operand<TFloat32> result = Swish.swish(tf, input);- Type Parameters:
T- the data type for the input- Parameters:
tf- the TensorFlow Opsinput- the input- Returns:
- the Swish activation , @code swish(x) = x * sigmoid(x)}.
-
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
-