mindspore/docs/api/api_python/mint/mindspore.mint.nn.Softshrin...

31 lines
902 B
ReStructuredText
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.mint.nn.Softshrink
============================
.. py:class:: mindspore.mint.nn.Softshrink(lambd=0.5)
逐元素计算Soft Shrink激活函数。公式定义如下
.. math::
\text{SoftShrink}(x) =
\begin{cases}
x - \lambda, & \text{ if } x > \lambda \\
x + \lambda, & \text{ if } x < -\lambda \\
0, & \text{ otherwise }
\end{cases}
SoftShrink激活函数图
.. image:: ../images/Softshrink.png
:align: center
参数:
- **lambd** (number可选) - Softshrink公式定义的阈值 :math:`\lambda` ,不小于零。默认 ``0.5``
输入:
- **input** (Tensor) - 输入tensor。支持数据类型
- Ascendmindspore.float16、mindspore.float32、mindspore.bfloat16。
- CPU/GPUmindspore.float16、mindspore.float32。
输出:
Tensor。