-
-
Notifications
You must be signed in to change notification settings - Fork 56.3k
bug fixed of GEMM node in ONNX_importer #22122
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
Conversation
Mat weights = getBlob(node_proto, 1); | ||
int ind_num_out = 0; | ||
|
||
if (layerParams.has("transB") && !layerParams.get<int>("transB")) { |
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.
Sometimes onnx operator will not set attr, for example:
onnx.helper.make_node(
'Gemm',
['a', 'b', 'c'],
['y'],
#transB=0)
Both transB and transA are not specified, in case like this, onnx would treat attrs as default value(which is 0),
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 for mentioning this, it has been fixed.
84b3f55
to
581d7dc
Compare
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.
Thank you!
int ind_num_out = 0; | ||
if (layerParams.has("transB") && !layerParams.get<int>("transB")) { | ||
|
||
if (!layerParams.has("transB") || (layerParams.has("transB") && !layerParams.get<int>("transB"))) |
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.
You can supply default value to get: if (!layerParams.get<int>("transB", 0))
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.
Agree.
7a093b0
to
2411b82
Compare
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!
@zihaomu, sorry, I missed the branch name. The same bug is present in 3.4 branch. Please create another PR backporting the fix. As for the future PRs: as a rule of thumb, we fix everything in 3.4 and merge the fixes into 4.x. New features go straight to 4.x. |
Hi @rogday. Does this mean that if 3.4 and 4.x have the same bug, we only push code to 3.4 branch? |
Yup. |
Merge with extra: opencv/opencv_extra#982
Related Issue 22096
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.