Skip to content

dnn: add openvino, opencl and cuda backends for layer normalization layer#24552

Merged
asmorkalov merged 8 commits intoopencv:4.xfrom
fengyuentau:layernorm_backends
Nov 21, 2023
Merged

dnn: add openvino, opencl and cuda backends for layer normalization layer#24552
asmorkalov merged 8 commits intoopencv:4.xfrom
fengyuentau:layernorm_backends

Conversation

@fengyuentau
Copy link
Copy Markdown
Member

@fengyuentau fengyuentau commented Nov 16, 2023

Merge after #24544.

Todo:

  • openvino
  • opencl
  • cuda

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake
force_builders=Linux OpenCL,Win64 OpenCL

@fengyuentau fengyuentau added this to the 4.9.0 milestone Nov 16, 2023
@fengyuentau fengyuentau requested a review from dkurt November 16, 2023 09:23
@dkurt
Copy link
Copy Markdown
Member

dkurt commented Nov 16, 2023

Oh, wait a minute, why we need continue development of LayerNorm layer while there is a new InstanceNorm layer #24378? I expected that LayerNorm should be removed completely.

@fengyuentau
Copy link
Copy Markdown
Member Author

We agreed previously in the meeting that we keep two classes, and they share similar kernels for CPU.

@dkurt
Copy link
Copy Markdown
Member

dkurt commented Nov 16, 2023

Let's see the final state. As far as I remember the only difference between them is scalar or vector scale/bias values,

@fengyuentau
Copy link
Copy Markdown
Member Author

Let's see the final state. As far as I remember the only difference between them is scalar or vector scale/bias values,

Indexing is also different as well. For Instance Normalization, its indexing is like scale[outer_idx % C]; while for Layer Normalization, its indexing is like scale[j] for j in inner_size.

@asmorkalov asmorkalov merged commit d05fb70 into opencv:4.x Nov 21, 2023
@fengyuentau fengyuentau deleted the layernorm_backends branch November 22, 2023 03:48
IskXCr pushed a commit to Haosonn/opencv that referenced this pull request Dec 20, 2023
dnn: add openvino, opencl and cuda backends for layer normalization layer opencv#24552

Merge after opencv#24544.

Todo:

- [x] openvino
- [x] opencl
- [x] cuda

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
@asmorkalov asmorkalov mentioned this pull request Jan 19, 2024
thewoz pushed a commit to thewoz/opencv that referenced this pull request May 29, 2024
dnn: add openvino, opencl and cuda backends for layer normalization layer opencv#24552

Merge after opencv#24544.

Todo:

- [x] openvino
- [x] opencl
- [x] cuda

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants