Files
openvino/docs/ops/activation/GELU_2.md
T

71 lines
1.7 KiB
Markdown
Raw Normal View History

2022-04-13 11:14:24 +02:00
# GELU {#openvino_docs_ops_activation_GELU_2}
2020-06-19 14:39:57 +03:00
2023-04-28 08:47:50 +02:00
@sphinxdirective
2023-07-03 13:09:07 +02:00
.. meta::
:description: Learn about Gelu-2 - an element-wise, activation operation, which
can be performed on a single tensor in OpenVINO.
2023-04-28 08:47:50 +02:00
2020-06-19 14:39:57 +03:00
**Versioned name**: *Gelu-2*
2021-03-31 17:43:07 +02:00
**Category**: *Activation function*
2020-06-19 14:39:57 +03:00
2021-03-31 17:43:07 +02:00
**Short description**: Gaussian error linear unit element-wise activation function.
2020-06-19 14:39:57 +03:00
2021-03-31 17:43:07 +02:00
**Detailed description**
2020-06-19 14:39:57 +03:00
2023-04-28 08:47:50 +02:00
*Gelu* operation is introduced in this `article <https://arxiv.org/abs/1606.08415>`__.
2021-03-31 17:43:07 +02:00
It performs element-wise activation function on a given input tensor, based on the following mathematical formula:
2020-06-19 14:39:57 +03:00
2023-04-28 08:47:50 +02:00
.. math::
Gelu(x) = x\cdot\Phi(x) = x\cdot\frac{1}{2}\cdot\left[1 + erf\frac{x}{\sqrt{2}}\right]
2020-06-19 14:39:57 +03:00
2021-03-31 17:43:07 +02:00
where Φ(x) is the Cumulative Distribution Function for Gaussian Distribution.
2023-04-28 08:47:50 +02:00
Additionally, the *Gelu* function may be approximated as follows:
.. math::
Gelu(x) \approx 0.5\cdot x\cdot \left(1 + \tanh\left[\sqrt{2/\pi} \cdot (x + 0.044715 \cdot x^3)\right]\right)
2020-07-15 10:30:33 +03:00
2021-03-31 17:43:07 +02:00
**Attributes**: *Gelu* operation has no attributes.
2020-06-19 14:39:57 +03:00
**Inputs**:
2023-04-28 08:47:50 +02:00
* **1**: A tensor of type *T* and arbitrary shape. **Required.**
2020-06-19 14:39:57 +03:00
**Outputs**:
2023-04-28 08:47:50 +02:00
* **1**: The result of element-wise *Gelu* function applied to the input tensor. A tensor of type *T* and the same shape as input tensor.
2021-03-31 17:43:07 +02:00
**Types**
* *T*: arbitrary supported floating-point type.
2020-06-19 14:39:57 +03:00
**Example**
.. code-block:: xml
:force:
2023-04-28 08:47:50 +02:00
<layer ... type="Gelu">
<input>
<port id="0">
<dim>1</dim>
<dim>128</dim>
</port>
</input>
<output>
<port id="1">
<dim>1</dim>
<dim>128</dim>
</port>
</output>
</layer>
@endsphinxdirective