Tanhshrink

Tanhshrink#

class brainpy.dnn.Tanhshrink(name=None, mode=None)[source]#

Applies the element-wise function:

\[\text{Tanhshrink}(x) = x - \tanh(x)\]
Shape:
  • Input: \((*)\), where \(*\) means any number of dimensions.

  • Output: \((*)\), same shape as the input.

Examples:

>>> import brainpy as bp
>>> import brainpy.math as bm
>>> m = bp.dnn.Tanhshrink()
>>> input = bm.random.randn(2)
>>> output = m(input)
update(input)[source]#

The function to specify the updating rule.

Return type:

TypeVar(ArrayType, Array, Variable, TrainVar, Array, ndarray)