Hardshrink#
- class torch.nn.Hardshrink(lambd=0.5)[source]#
Element-wise applies the Hard Shrinkage (Hardshrink) function.
Hardshrink 定义为
- 参数
lambd (float) – The value for the Hardshrink formulation. Default: 0.5
- 形状
Input: , where represents any number of dimensions.
Output: , same shape as the input.
示例
>>> m = nn.Hardshrink() >>> input = torch.randn(2) >>> output = m(input)