dnn: add more CANN operators to support SAM#23550
dnn: add more CANN operators to support SAM#23550fengyuentau wants to merge 14 commits intoopencv:4.xfrom
Conversation
…unsqueeze; support layernorm fusion variances; support getting 1d desc
|
|
||
| // opencv attr | ||
| hasBias = params.get<bool>("hasBias", false); | ||
| is1D = params.get<bool>("is1D", false); |
There was a problem hiding this comment.
If I'm not mistaken, in case of 1D cv::Mat it has N rows and 1 column (Nx1). So with axis = 0 it should be correct. I think using such shortcut from MVN is enough:
opencv/modules/dnn/src/layers/mvn_layer.cpp
Lines 331 to 346 in 2ff16d4
There was a problem hiding this comment.
@dkurt, in 4.x there is no support for 1D. In 5.x I have added support for 1D and 0D matrices. 1D matrix of N elements may be interpreted (if you ignore Mat::dims) as 1xN 2D matrix, i.e. it's a single-row matrix, not single-column
There was a problem hiding this comment.
My point is that instead of extra is1D flag there is a check that let skip layer compute because output values will be all zeros.
There was a problem hiding this comment.
The 1d flag is introduced for other backends to avoid incorrect shape inference. Let me try to bypass this...
Lets say axis=-1 and the shape of scale mat is still 2d; that stands for a 1d scale and bias tensor.
|
This PR is too out-of-date. Created a new PR #24756 in place of this one. |
|
What's about Mod layer? |
Sure, let me do it in a new PR. |
This PR is based on #23491. Need to merge #23491 first then rebase this PR.
To-do list:
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.