brelu_cn.rst 1.0 KB
Newer Older
H
Hao Wang 已提交
1 2 3 4 5 6 7 8
.. _cn_api_fluid_layers_brelu:

brelu
-------------------------------

.. py:function:: paddle.fluid.layers.brelu(x, t_min=0.0, t_max=24.0, name=None)


9
BReLU 激活函数
H
Hao Wang 已提交
10

11
.. math::   out=min(max(x,t\_min),t\_max)
H
Hao Wang 已提交
12 13

参数:
14 15 16 17 18 19 20 21
  - **x** (Variable) - 该OP的输入为多维Tensor。数据类型为float32,float64。
  - **t_min** (float, 可选) - BRelu的最小值,默认值为0.0。
  - **t_max** (float, 可选) - BRelu的最大值,默认值为24.0。
  - **name** (str, 可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为None。

返回: 输出为Tensor,与 ``x`` 维度相同、数据类型相同。

返回类型: Variable
H
Hao Wang 已提交
22 23 24 25 26 27 28


**代码示例:**

.. code-block:: python

    import paddle.fluid as fluid
29 30 31 32 33 34 35 36 37
    import numpy as np

    input_brelu = np.array([[-1,6],[1,15.6]])
    with fluid.dygraph.guard():
        x = fluid.dygraph.to_variable(input_brelu)
        y = fluid.layers.brelu(x, t_min=1.0, t_max=10.0)
        print(y.numpy())
        #[[ 1.  6.]
        #[ 1. 10.]]