HardSigmoid

public class HardSigmoid

Hard sigmoid activation.

A faster approximation of the sigmoid activation.

Defined as:

  • if x < -2.5: return 0
  • if x > 2.5: return 1
  • if -2.5 <= x <= 2.5: return 0.2 * x + 0.5

For example:

     Operand<TFloat32> input = tf.constant(
              new float[] {-3.0f,-1.0f, 0.0f,1.0f,3.0f});
     HardSigmoid<TFloat32> hardSigmoid = new HardSigmoid<>(tf);
     Operand<TFloat32> result = hardSigmoid.call(input);
     // result is [0.f , 0.3f, 0.5f, 0.7f, 1.f]
 

Public Constructors

HardSigmoid(Ops tf)
Creates Hard sigmoid activation.

Public Methods

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

Inherited Methods

org.tensorflow.framework.activations.Activation
abstract Operand<T>
call(Operand<T> input)
Gets the calculation operation for the activation.
boolean
equals(Object arg0)
final Class<?>
getClass()
int
hashCode()
final void
notify()
final void
notifyAll()
String
toString()
final void
wait(long arg0, int arg1)
final void
wait(long arg0)
final void
wait()

Public Constructors

public HardSigmoid (Ops tf)

Creates Hard 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