2.3K Star 8.1K Fork 4.3K

GVPMindSpore / mindspore

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
mindspore.ops.func_softshrink.rst 962 Bytes
一键复制 编辑 原始数据 按行查看 历史
宦晓玲 提交于 2024-03-29 15:53 . modify the format and contents 2.3

mindspore.ops.softshrink

.. py:function:: mindspore.ops.softshrink(x, 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

    参数:
        - **x** (Tensor) - Soft Shrink的输入,数据类型为float16或float32。
        - **lambd** (float) - :math:`\lambda` ,应大于等于0。默认值: ``0.5`` 。

    返回:
        Tensor,shape和数据类型与 `x` 相同。

    异常:
        - **TypeError** - `lambd` 不是float。
        - **TypeError** - `x` 不是Tensor。
        - **TypeError** - `x` 的dtype既不是float16也不是float32。
        - **ValueError** - `lambd` 小于0。
Python
1
https://gitee.com/mindspore/mindspore.git
git@gitee.com:mindspore/mindspore.git
mindspore
mindspore
mindspore
master

搜索帮助