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

【Hackathon 5th No.95】add paddle unique op #20077

Merged
merged 7 commits into from
Dec 15, 2023

Conversation

AndPuQing
Copy link
Contributor

@AndPuQing AndPuQing commented Sep 27, 2023

Details:

  • add paddle unique op convert support

Tickets:

reference

image

Note

dtype float32, int32, int64 would be supported, float64 ov TestConvert not be supported

@AndPuQing AndPuQing requested a review from a team as a code owner September 27, 2023 08:59
@github-actions github-actions bot added the category: PDPD FE OpenVINO PaddlePaddle FrontEnd label Sep 27, 2023

if (axis.size() != 0) {
auto axis_node = std::make_shared<default_opset::Constant>(element::i32, Shape{}, axis);
outputs = std::make_shared<ov::opset10::Unique>(x, axis_node, true, dtype, dtype)->outputs();
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use default_opset other than opset10 ?

Copy link
Contributor Author

@AndPuQing AndPuQing Nov 5, 2023

Choose a reason for hiding this comment

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

To the best of my knowledge, the unique operator is defined in opset10

But the default_opset is 9

Copy link
Contributor

Choose a reason for hiding this comment

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

It is okay here. I will upgrate the default_opset later.

reture_inverse=False,
reture_counts=False,
dtype="int64",
axes=None,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we leave these parameter's name as origin one, which can be loaded to paddle.unique directly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Already fixed.

@openvino-dev-samples
Copy link
Contributor

@yuxu42 Could you help to have a review on this PR, thanks

@yuxu42
Copy link
Contributor

yuxu42 commented Nov 6, 2023

@ceciliapeng2011 could you please help reivew? Thanks!

@yuxu42 yuxu42 added ExternalPR External contributor PaddlePaddle Hackathon a Intel and Baidu joint Hackathon event labels Nov 10, 2023
Copy link
Contributor

This PR will be closed in a week because of 2 weeks of no activity.

@github-actions github-actions bot added the Stale label Nov 25, 2023
@yuxu42 yuxu42 requested a review from xczhai November 27, 2023 01:22
for out in unique_outs:
if out is not None:
if out.dtype == paddle.int64 or out.dtype == paddle.int32:
out = paddle.cast(out, "float32")
Copy link
Contributor

Choose a reason for hiding this comment

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

I can't figure out why cast operation is needed. In my understanding, we should keep the original unique output for verification.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

AFAIK, the openvino test compare_results only support fp32 & int32, so for the int64 index we should convert to float32/int32

Copy link
Contributor

Choose a reason for hiding this comment

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

@AndPuQing Thanks for your very detailed analysis. Your finding makes sense.
Maybe the test case framework is not perfect enough to call. Don't worry at all. If you think it is not reasonable, just pull PR to fix or optimize it, which is much appreciated. We should NOT skip it using a work-around.
If you have no time for this case, let me know.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, it seems I may not have the time to rectify the test case framework.


named_outputs["Index"] = {outputs[2]};
named_outputs["Indices"] = {outputs[1]};
named_outputs["Counts"] = {outputs[3]};
Copy link
Contributor

@xczhai xczhai Nov 27, 2023

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.

In paddle, the count_element_type and index_element_type both be controlled by attr_dtype

auto x = node.get_input("X");

std::vector<Output<Node>> outputs;
NamedOutputs named_outputs;
Copy link
Contributor

Choose a reason for hiding this comment

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

As far as I know, the NamedOutputs is a std::map.
In this case, you'd better use constructor with initailization list insteading of inserting k-v one by one, I think.

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

@yuxu42
Copy link
Contributor

yuxu42 commented Dec 1, 2023

@AndPuQing could you please fix the issues and rebase the code? Thanks!

@AndPuQing AndPuQing changed the title 【PaddlePaddle Hackathon 5】add paddle unique op 【Hackathon 5th No.95】add paddle unique op Dec 4, 2023
@AndPuQing
Copy link
Contributor Author

@AndPuQing could you please fix the issues and rebase the code? Thanks!

Done

@openvino-dev-samples
Copy link
Contributor

Could you change the PR's title as 【Paddle Hackathon 5th No.95】?

@yuxu42
Copy link
Contributor

yuxu42 commented Dec 12, 2023

@ceciliapeng2011 can we merge the PR? Thanks!

@ceciliapeng2011 ceciliapeng2011 merged commit a28fd2e into openvinotoolkit:master Dec 15, 2023
41 checks passed
@AndPuQing AndPuQing deleted the feature-unique branch December 15, 2023 03:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: PDPD FE OpenVINO PaddlePaddle FrontEnd ExternalPR External contributor PaddlePaddle Hackathon a Intel and Baidu joint Hackathon event
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants