-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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 new one hot function in nn.functional #26183
Conversation
Thanks for your contribution! |
✅ This PR's description meets the template requirements! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This reverts commit a8e93e3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, lod_level>1 的输入的 lod 信息现在不能正确地被处理,暂 disable
:alias_main: paddle.nn.functional.one_hot | ||
:alias: paddle.nn.functional.one_hot,paddle.nn.functional.common.one_hot | ||
:old_api: paddle.fluid.one_hot | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
别名标识这三行按照新的规定,可以删去,以后会自动补这三行内容
import paddle.fluid as fluid | ||
# Correspond to the first example above, where label.shape is 4 and one_hot_label.shape is [4, 4]. | ||
label = fluid.data(name="label", shape=[4, 1], dtype="int64") | ||
one_hot_label = fluid.one_hot(x=label, num_classes=4) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
代码示例用注释的形式给出具体的输入和输出
9470f34
self.assertRaises(core.EnforceNotMet, run) | ||
|
||
|
||
class TestOneHotOpApi(unittest.TestCase): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API 测试不测试结果的正确性吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR types
New features
PR changes
OPs
Describe
add new one_hot function and change it's interface