Skip to content

Conversation

@qili93
Copy link
Contributor

@qili93 qili93 commented Aug 17, 2020

新增/修改如下2.0 API:

ELU:

  • paddle.nn.ELU(alpha=1.0, name=None) - 新增此class
  • paddle.nn.functional.elu(x, alpha=1.0, name=None) - 新增此function

GELU

  • paddle.nn.GELU(alpha=1.0, name=None) - 新增此class
  • paddle.nn.functional.gelu(x, approximate=False, name=None) - 新增此function,参数approximate保留

ReLU

  • paddle.nn.ReLU(name=None) - 保持,删除alias, 删除inplace, input改为x,
  • paddle.nn.functional.relu(x, alpha=1.0, name=None) - 删除inplace,input改为x,完善文档改用动态图demo

LogSigmoid

  • paddle.nn.LogSigmoid(name=None) - 新增此class
  • paddle.nn.functional.logsigmoid(x, name=None) - 新增此function

elu
gelu
relu
logsigmoid

Copy link
Contributor

@zhupengyang zhupengyang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

paddle.disable_static()
x = paddle.to_tensor(np.array([[-1,6],[1,15.6]]))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

逗号后面加个空格?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


代码示例
::::::::::

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

少了这一行:【.. code-block:: python】

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

参数:
::::::::::
- x (Tensor) - 输入的 ``Tensor`` ,数据类型为:float32、float64。
- approximate (bool, 可选) - 是否使用近似计算,默认值为 False。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里最好明确下False的行为,如:
【- approximate (bool, 可选) - 是否使用近似计算,默认值为 False,表示不使用近似计算。】

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

ELU激活层(ELU Activation Operator)

根据 https://arxiv.org/abs/1511.07289 对输入Tensor中每个元素应用以下计算。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里直接放链接不太好,建议改成和GELU一样的格式,可以参考:
【根据 Exponential Linear Units <https://arxiv.org/abs/1511.07289> 对输入Tensor中每个元素应用以下计算。】

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -0,0 +1,36 @@
.. _cn_api_nn_ReLU:

ELU
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里应该是【ReLU】;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


ELU
-------------------------------
.. py:class:: paddle.nn.ELU(x, alpha=1.0, name=None)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

【ELU】的参数里没有【x】

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -0,0 +1,54 @@
.. _cn_api_fluid_layers_gelu:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个地方,应该是【_cn_api_nn_GELU】

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


参数
::::::::::
- approximate (bool, 可选) - 是否使用近似计算,默认值为 False。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里最好描述下False的行为,可以参考:
【 - approximate (bool, 可选) - 是否使用近似计算,默认值为 False,即不使用近似计算。】

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

paddle.disable_static()
data = np.random.randn(2, 3).astype("float32")
x = paddle.to_tensor(data)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里可否换为非随机的输入?随机的输入最后的输出无法具有参考性~

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

LogSigmoid
-------------------------------
.. py:class:: paddle.nn.LogSigmoid(x, name=None)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里也没有【x】

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

ELU
-------------------------------
.. py:class:: paddle.nn.ReLU(x, name=None)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里也没有 【x】

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

elu激活层(ELU Activation Operator)

根据 https://arxiv.org/abs/1511.07289 对输入Tensor中每个元素应用以下计算。

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

根据 Exponential Linear Units <https://arxiv.org/abs/1511.07289> 对输入Tensor中每个元素应用以下计算。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Collaborator

@TCChenlong TCChenlong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM~

@zhupengyang zhupengyang merged commit de8a21a into PaddlePaddle:develop Aug 19, 2020
@qili93 qili93 deleted the new_20_api branch August 19, 2020 09:37
@qili93
Copy link
Contributor Author

qili93 commented Aug 20, 2020

ELU English Doc

class_ELU
function_elu

@qili93
Copy link
Contributor Author

qili93 commented Aug 20, 2020

GELU English Doc

class_GELU
function_gelu

@qili93
Copy link
Contributor Author

qili93 commented Aug 20, 2020

RELU English Doc

class_ReLU
function_relu

@qili93
Copy link
Contributor Author

qili93 commented Aug 20, 2020

LogSigmoid English Doc

class_LogSigmoid
function_logsigmoid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants