mindspore/docs/api/api_python/ops/mindspore.ops.func_glu.rst

24 lines
1023 B
ReStructuredText
Raw Normal View History

2022-09-22 11:53:09 +08:00
mindspore.ops.glu
=================
2022-10-13 20:20:49 +08:00
.. py:function:: mindspore.ops.glu(x, axis=-1)
2022-09-22 11:53:09 +08:00
门线性单元函数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
2022-11-01 19:52:13 +08:00
其中,:math:`a` 表示输入input_x 拆分后 Tensor的前一半元素:math:`b` 表示输入拆分Tensor的另一半元素。:math:`\sigma` 是sigmoid函数 :math:`*` 是Hadamard乘积。
请参考 `Language Modeling with Gated Convluational Networks <https://arxiv.org/abs/1612.08083>`_.
2022-09-22 11:53:09 +08:00
参数:
2022-11-04 10:40:03 +08:00
- **x** (Tensor) - 被分Tensor数据类型为number.Number, shape为 :math:`(\ast_1, N, \ast_2)` ,其中 `*` 为任意额外维度。
2022-11-01 19:52:13 +08:00
- **axis** (int可选) - 指定分割轴。数据类型为整型,默认值:-1。
2022-09-22 11:53:09 +08:00
返回:
2022-11-07 10:03:32 +08:00
Tensor数据类型与输入 `x` 相同shape为 :math:`(\ast_1, M, \ast_2)`,其中 :math:`M=N/2`
2022-10-14 09:32:48 +08:00
异常:
2022-11-01 19:52:13 +08:00
- **TypeError** - `x` 数据类型不是number.Number。
2022-10-17 11:39:16 +08:00
- **TypeError** - `x` 不是Tensor。