Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add nn.functional.normalize API for API2.0, fix L1Loss API typo #26269

Merged
merged 3 commits into from
Aug 18, 2020

Conversation

LutaoChu
Copy link
Contributor

PR types

New features,Bug fixes

PR changes

APIs,Docs

Describe

1 add nn.functional.normalize API for API2.0,
2 fix L1Loss API typo: x -> input, remove 'scalar'

@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

axis (int, optional): The axis on which to apply normalization. If `x` is 1-D tensor, `axis` is fixed to 0. If `axis < 0`, \
the dimension to normalization is rank(X) + axis. -1 is the last dimension.
epsilon (float, optional): Small float added to denominator to avoid dividing by zero. Default is 1e-12.
name (str, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.
Copy link
Contributor

Choose a reason for hiding this comment

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

name 对齐

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


import paddle
import paddle.nn.functional as F
import numpy as np
Copy link
Contributor

Choose a reason for hiding this comment

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

import numpy as np 放在第一行import, pep8规范

Copy link
Contributor Author

@LutaoChu LutaoChu Aug 14, 2020

Choose a reason for hiding this comment

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

done. 是因为按字母序吗?

x = paddle.to_variable(self.input_np2)
y = F.normalize(x)
self.assertTrue(np.allclose(y.numpy(), self.expected3))

Copy link
Contributor

Choose a reason for hiding this comment

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

eps单测是否需要增加一个?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

eps用来防止除零,上面这行就是验证除零时eps是否生效了,输入特意构造了全零tensor

Copy link
Contributor

@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

Copy link
Contributor

@wawltor wawltor left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@WuHaobo WuHaobo left a comment

Choose a reason for hiding this comment

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

LGTM

@wawltor wawltor merged commit 71b19c7 into PaddlePaddle:develop Aug 18, 2020
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.

4 participants