Softshrink
-
class torch.nn.Softshrink(lambd=0.5)[source][source]
应用逐元素软收缩函数。
SoftShrinkage(x)=⎩⎨⎧x−λ,x+λ,0, if x>λ if x<−λ otherwise
- 参数:
lambd(浮点数)- Softshrink 公式的 λ (必须不小于零)值。默认:0.5
- 形状:
-
示例:
>>> m = nn.Softshrink()
>>> input = torch.randn(2)
>>> output = m(input)