ncdl.nn.Tanhshrink

class ncdl.nn.Tanhshrink(*args: Any, **kwargs: Any)

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.

scripts/activation_images/Tanhshrink.png

Examples:

>>> m = nn.Tanhshrink()
>>> input = torch.randn(2)
>>> output = m(input)
__init__(*args: Any, **kwargs: Any) None

Methods

__init__(*args, **kwargs)

forward(input)