2.4K Star 8.2K Fork 4.4K

GVPMindSpore / mindspore

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
silu_doc.yaml 1.16 KB
一键复制 编辑 原始数据 按行查看 历史
jiaxueyu 提交于 2024-03-28 19:06 . add silu png for English version
silu:
description: |
Computes Sigmoid Linear Unit of input element-wise. The SiLU function is defined as:
.. math::
\text{SiLU}(x) = x * \sigma(x),
where :math:`x` is an element of the input, :math:`\sigma(x)` is Sigmoid function.
.. math::
\text{sigma}(x_i) = \frac{1}{1 + \exp(-x_i)},
SiLU Function Graph:
.. image:: ../images/SiLU.png
:align: center
Args:
input (Tensor): `input` is :math:`x` in the preceding formula. Input with the data type
float16 or float32.
Returns:
Tensor, with the same type and shape as the `input`.
Raises:
TypeError: If dtype of `input` is neither float16 nor float32.
Supported Platforms:
``Ascend`` ``GPU`` ``CPU``
Examples:
>>> import mindspore
>>> from mindspore import Tensor, ops
>>> import numpy as np
>>> input = Tensor(np.array([-1, 2, -3, 2, -1]), mindspore.float16)
>>> output = ops.silu(input)
>>> print(output)
[-0.269 1.762 -0.1423 1.762 -0.269]
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/mindspore/mindspore.git
git@gitee.com:mindspore/mindspore.git
mindspore
mindspore
mindspore
master

搜索帮助