bug fixed of GEMM node in ONNX_importer#22122
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.
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.
Thanks for mentioning this, it has been fixed.
84b3f55 to
581d7dc
Compare
| 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.
You can supply default value to get: if (!layerParams.get<int>("transB", 0))
7a093b0 to
2411b82
Compare
|
@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.