-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
【PaddlePaddle Hackathon 4】add paddle one_hot_v2 op #15859
【PaddlePaddle Hackathon 4】add paddle one_hot_v2 op #15859
Conversation
The inputs received by PEPE frontend API are relatively simplified comparing to the OV op |
Could confirm it with Paddle‘s team, I still see this |
I leaved a issue about this question, I will comment on this pr as soon as paddle team reply. |
@OpenVINO-dev-contest I understand that only when the shape of num_class is 0-D, it is valid as input. I have added a corresponding test sample. |
Head branch was pushed to by a user without write access
auto depth_value = node.get_input("depth_tensor"); | ||
depth = std::make_shared<default_opset::Squeeze>(depth_value); | ||
} else { | ||
auto depth_value = node.get_attribute<int>("depth"); |
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.
Hi can we leave it as const
, and also set a default value for the attributes
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.
1.const had been added
2.input without num_class is not permitted in paddle, so I think it is presumably not needful to set a default value. If it is necessary, the default number of classes could be set as one greater than the largest class value in the input tensor, according to the pytorch implement.
import sys | ||
|
||
|
||
def one_hot_v2_1(name: str, x, num_classes): |
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.
Since there are some duplicated code, can we combine these 2 functions together? You can refer to top_k_v2
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.
Done
Pls update the URL with English version of OP description, thanks |
URL updated |
depth = std::make_shared<default_opset::Squeeze>(depth_value); | ||
} else { | ||
const auto depth_value = node.get_attribute<int>("depth", -1); | ||
if (depth_value == -1) { |
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.
Why should we consider the depth
as -1 or a negative, is it a available value in Paddle‘s model ? if yes, could you help to add a new case in uni-test ?
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.
Like I mentioned before, input without num_class
is not permitted in Paddle‘s model and negative value is also not available. So I think it is better not to set a default value for num_class
. If it must has a default value, I would recommend -1
, same as the pytorch implement. If we don't need a default value, I will remove it latter.
num_classes (int) – Total number of classes. If set to -1, the number of classes will be inferred as one greater than the largest class value in the input tensor.
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.
Thanks. Could you help to confirm if paddle will throw an exception when we set the num_class
as -1/negative ? If Paddle will reject this case, i think we can remove the default value in OV's frontend.
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.
Can one of the admins verify this patch? |
could you help update the doc? https://github.com/openvinotoolkit/openvino/blob/master/docs/MO_DG/prepare_model/Supported_Frameworks_Layers.md |
So I need to add note at the end of paddle limitation?
I'm not sure whether it is a good description. |
@Patrick-Star125 How about passing input with N-dims? |
Head branch was pushed to by a user without write access
sure, done |
src/frontends/paddle/tests/test_models/gen_scripts/generate_one_hot_v2.py
Show resolved
Hide resolved
adding one_hot_v2 to PdPd aligning with openvinotoolkit#15859
Details:
add one_hot_v2 operation in Paddle front end
Reference:
unit-test