tanh_cn.rst 593 字节
Newer Older
H
Hao Wang 已提交
1 2 3 4 5 6 7 8
.. _cn_api_fluid_layers_tanh:

tanh
-------------------------------

.. py:function:: paddle.fluid.layers.tanh(x, name=None)


9
tanh 激活函数
H
Hao Wang 已提交
10 11 12 13 14 15 16 17

.. math::
    out = \frac{e^{x} - e^{-x}}{e^{x} + e^{-x}}


参数:

    - **x** - Tanh算子的输入
18 19 20
    - **name** (str|None) - 该层名称(可选)。若设为None,则自动为该层命名。

返回: 张量(Tensor)
H
Hao Wang 已提交
21

22
返回类型: 变量(Variable)
H
Hao Wang 已提交
23 24 25 26 27

**代码示例**:

.. code-block:: python

28 29 30
    import paddle.fluid as fluid
    data = fluid.layers.data(name="input", shape=[32, 784])
    result = fluid.layers.tanh(data)
H
Hao Wang 已提交
31 32 33 34 35 36 37 38 39 40 41 42 43