Tanhshrink

Contents

Tanhshrink#

class brainstate.nn.Tanhshrink(name=None)#

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 brainstate.nn as nn
>>> import brainstate
>>> m = nn.Tanhshrink()
>>> x = brainstate.random.randn(2)
>>> output = m(x)