2021-12-21 20:26:37 +03:00
|
|
|
# Tanh {#openvino_docs_ops_arithmetic_Tanh_1}
|
2020-06-19 14:39:57 +03:00
|
|
|
|
|
|
|
|
**Versioned name**: *Tanh-1*
|
|
|
|
|
|
2021-08-23 12:12:46 +02:00
|
|
|
**Category**: *Arithmetic unary*
|
2020-06-19 14:39:57 +03:00
|
|
|
|
2021-05-05 13:27:51 +02:00
|
|
|
**Short description**: *Tanh* performs element-wise hyperbolic tangent (tanh) operation with given tensor.
|
2020-06-19 14:39:57 +03:00
|
|
|
|
2021-05-05 13:27:51 +02:00
|
|
|
**Detailed description**
|
|
|
|
|
|
|
|
|
|
For each element from the input tensor calculates corresponding element in the output tensor with the following formula:
|
|
|
|
|
\f[
|
|
|
|
|
tanh ( x ) = \frac{2}{1+e^{-2x}} - 1 = 2sigmoid(2x) - 1
|
|
|
|
|
\f]
|
|
|
|
|
|
|
|
|
|
* For integer element type the result is rounded (half up) to the nearest integer value.
|
|
|
|
|
|
|
|
|
|
**Attributes**: *Tanh* operation has no attributes.
|
2020-06-19 14:39:57 +03:00
|
|
|
|
|
|
|
|
**Inputs**:
|
|
|
|
|
|
2021-05-05 13:27:51 +02:00
|
|
|
* **1**: A tensor of type *T* and arbitrary shape. **Required.**
|
2020-06-19 14:39:57 +03:00
|
|
|
|
|
|
|
|
**Outputs**:
|
|
|
|
|
|
2021-05-05 13:27:51 +02:00
|
|
|
* **1**: The result of element-wise *Tanh* operation. A tensor of type *T* and the same shape as input tensor.
|
|
|
|
|
**Types**
|
2020-06-19 14:39:57 +03:00
|
|
|
|
2021-05-05 13:27:51 +02:00
|
|
|
* *T*: any numeric type.
|
2020-06-19 14:39:57 +03:00
|
|
|
|
2021-05-05 13:27:51 +02:00
|
|
|
|
|
|
|
|
**Examples**
|
|
|
|
|
|
|
|
|
|
*Example 1*
|
|
|
|
|
|
|
|
|
|
```xml
|
|
|
|
|
<layer ... type="Tanh">
|
|
|
|
|
<input>
|
|
|
|
|
<port id="0">
|
|
|
|
|
<dim>256</dim>
|
|
|
|
|
<dim>56</dim>
|
|
|
|
|
</port>
|
|
|
|
|
</input>
|
|
|
|
|
<output>
|
|
|
|
|
<port id="1">
|
|
|
|
|
<dim>256</dim>
|
|
|
|
|
<dim>56</dim>
|
|
|
|
|
</port>
|
|
|
|
|
</output>
|
|
|
|
|
</layer>
|
|
|
|
|
```
|