Class Softplus

java.lang.Object
org.tensorflow.framework.activations.AbstractActivation
org.tensorflow.framework.activations.Softplus
All Implemented Interfaces:
Activation

public class Softplus extends AbstractActivation
Softplus activation function, softplus(x) = log(exp(x) + 1).

Example Usage:

Operand<TFloat32> input = tf.constant(
         new float[] {-20f, -1.0f, 0.0f, 1.0f, 20f});
Softplus<TFloat32> softplus = new Softplus<>(tf);
Operand<TFloat32> result = softplus.call(input);
// result is [2.0611537e-09f, 3.1326166e-01f, 6.9314718e-01f,
//                 1.3132616e+00f, 2.0000000e+01f]
  • Field Details

  • Constructor Details

    • Softplus

      public Softplus()
      Creates a Softplus activation function.
    • Softplus

      public Softplus(Map<String,Object> config)
      Creates a new Softplus 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

    • softplus

      public static <T extends TNumber> Operand<T> softplus(Ops tf, Operand<T> input)
      Applies the Softplus activation function, softplus(x) = log(exp(x) + 1).

      Example Usage:

      Operand<TFloat32> input = ...;
      Operand<TFloat32> result = Softplus.softplus(tf, input);
      
      Type Parameters:
      T - the data type for the input
      Parameters:
      tf - the TensorFlow Ops
      input - the input
      Returns:
      the Softplus activation, softplus(x) = log(exp(x) + 1).
    • call

      public <T extends TNumber> Operand<T> call(Ops tf, Operand<T> input)
      Gets the calculation operation for the activation.
      Type Parameters:
      T - the data type of the input and the result
      Parameters:
      tf - the TensorFlow Ops
      input - the input tensor
      Returns:
      The operand for the activation
    • getConfig

      public Map<String,Object> getConfig()
      Gets a configuration map
      Specified by:
      getConfig in class AbstractActivation
      Returns:
      the configuration map
    • getName

      public String getName()
      Get the name of the activation as known by the TensorFlow Engine
      Specified by:
      getName in class AbstractActivation
      Returns:
      the name of the activation as known by the TensorFlow Engine