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 new one hot function in nn.functional #26183

Merged
merged 14 commits into from
Aug 20, 2020

Conversation

yukavio
Copy link
Contributor

@yukavio yukavio commented Aug 12, 2020

PR types

New features

PR changes

OPs

Describe

add new one_hot function and change it's interface

@paddle-bot-old
Copy link

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

@paddle-bot-old
Copy link

paddle-bot-old bot commented Aug 12, 2020

✅ This PR's description meets the template requirements!
Please wait for other CI results.

iclementine
iclementine previously approved these changes Aug 14, 2020
Copy link

@iclementine iclementine left a comment

Choose a reason for hiding this comment

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

LGTM

@yukavio yukavio changed the title Add new op Add new one hot function in nn.functional Aug 14, 2020
iclementine
iclementine previously approved these changes Aug 14, 2020
Copy link

@iclementine iclementine left a 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

@wanghaoshuang wanghaoshuang self-requested a review August 14, 2020 09:01
wanghaoshuang
wanghaoshuang previously approved these changes Aug 14, 2020
: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

Copy link
Contributor

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)
Copy link
Contributor

Choose a reason for hiding this comment

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

代码示例用注释的形式给出具体的输入和输出

@yukavio yukavio dismissed stale reviews from wanghaoshuang and iclementine via 9470f34 August 17, 2020 02:50
@PaddlePaddle PaddlePaddle locked and limited conversation to collaborators Aug 17, 2020
@PaddlePaddle PaddlePaddle unlocked this conversation Aug 17, 2020
self.assertRaises(core.EnforceNotMet, run)


class TestOneHotOpApi(unittest.TestCase):

Choose a reason for hiding this comment

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

API 测试不测试结果的正确性吗?

Copy link

@iclementine iclementine 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

@swtkiwi swtkiwi 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

@XiaoguangHu01 XiaoguangHu01 left a comment

Choose a reason for hiding this comment

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

LGTM

@iclementine iclementine merged commit 8c48c7d into PaddlePaddle:develop Aug 20, 2020
@yukavio yukavio deleted the add_new_op branch August 22, 2020 15:38
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.

None yet

6 participants