sciai.architecture.Swish

查看源文件
class sciai.architecture.Swish[源代码]

带反向传播的 Swish(Silu) 激活函数。

输入:
  • x (Tensor) - Swish(Silu)的输入。

输出:

Tensor,shape与 x 一致的被激活的输出。

支持平台:

GPU CPU Ascend

样例:

>>> import mindspore as ms
>>> from mindspore import ops
>>> from sciai.architecture import Swish
>>> swish = Swish()
>>> x = ops.ones((2, 3), ms.float32)
>>> y = swish(x)
>>> print(y)
[[0.73105854 0.73105854 0.73105854]
[0.73105854 0.73105854 0.73105854]]