mindspore/docs/api/api_python/nn/mindspore.nn.GLU.rst

23 lines
701 B
ReStructuredText
Raw Normal View History

2022-09-22 11:53:09 +08:00
mindspore.nn.GLU
=================
.. py:class:: mindspore.nn.GLU(axis=-1)
门线性单元函数Gated Linear Unit function
2022-10-11 10:42:34 +08:00
.. math::
{GLU}(a, b)= a \otimes \sigma(b)
2022-09-22 11:53:09 +08:00
其中,:math:`a` 表示输入Tensor的前一半元素:math:`b` 表示输入Tensor的另一半元素。
2022-10-27 09:56:19 +08:00
这里 :math:`\sigma` 为sigmoid函数:math:`*` 为矩阵的基本乘。
2022-09-22 11:53:09 +08:00
参数:
2022-10-17 11:34:44 +08:00
- **axis** (int) - 指定分割轴。数据类型为整型,默认值:-1。
2022-09-22 11:53:09 +08:00
输入:
2022-10-27 09:56:19 +08:00
- **x** (Tensor) - Tensor的shape为 :math:`(\ast_1, N, \ast_2)`
2022-09-22 11:53:09 +08:00
输出:
2022-10-17 11:34:44 +08:00
Tensor数据类型与输入 `x` 相同shape等于 `x` 按照 `axis` 拆分后的一半。