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

[NPU] add one_hot_op_npu and tests #34258

Merged
merged 3 commits into from
Aug 9, 2021
Merged

Conversation

ronny1996
Copy link
Contributor

@ronny1996 ronny1996 commented Jul 20, 2021

PR types

Others

PR changes

OPs

Describe

add one_hot_op_npu and tests
ascend的one-hot算子支持out of range,类似cuda kernel实现
image

@paddle-bot-old
Copy link

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

@ronny1996 ronny1996 changed the title add one_hot_op and tests add one_hot_op_npu and tests Jul 20, 2021


@unittest.skipIf(not paddle.is_compiled_with_npu(),
"core is not compiled with NPU")
Copy link
Contributor

Choose a reason for hiding this comment

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

秋良在这个PR #34240 里面修改了,如果这个PR在秋良的PR之后合入的话,可以把这里的skipIf代码去掉。后面所有的class代码都一样可以去掉。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已更新

self.outputs = {'Out': (out, x_lod)}

def test_check_output(self):
self.check_output_with_place(paddle.NPUPlace(0), check_dygraph=False)
Copy link
Contributor

Choose a reason for hiding this comment

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

check_dygraph=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.

参考test_one_hot_op.py,删掉check_dygraph=False 会报错

Copy link
Contributor

Choose a reason for hiding this comment

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

好的

@ronny1996 ronny1996 requested a review from qili93 July 20, 2021 07:26
@ronny1996 ronny1996 changed the title add one_hot_op_npu and tests [NPU] add one_hot_op_npu and tests Jul 21, 2021
qili93
qili93 previously approved these changes Jul 23, 2021
Copy link
Contributor

@qili93 qili93 left a comment

Choose a reason for hiding this comment

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

LGTM

self.outputs = {'Out': (out, x_lod)}

def test_check_output(self):
self.check_output_with_place(paddle.NPUPlace(0), check_dygraph=False)
Copy link
Contributor

Choose a reason for hiding this comment

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

好的

@qili93 qili93 requested a review from phlrain July 23, 2021 07:24
runner.SetType("OneHot")
.AddInput(transformed_in)
.AddInput(std::vector<int32_t>({static_cast<int32_t>(depth)}))
.AddInput(on_value)
Copy link
Contributor

Choose a reason for hiding this comment

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

To make code clear, maybe on_value and off_value can write like depth

Copy link
Contributor

@zhiqiu zhiqiu left a comment

Choose a reason for hiding this comment

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

LGTM

@qili93 qili93 merged commit 4c1ba73 into PaddlePaddle:develop Aug 9, 2021
@ronny1996 ronny1996 deleted the npu_one_hot branch September 9, 2021 07:52
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