Skip to content
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

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

Merged
merged 8 commits into from Nov 21, 2023

Conversation

fengyuentau
Copy link
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
@dkurt
Copy link
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
Member Author

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

@dkurt
Copy link
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
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.

modules/dnn/src/cuda/mvn.cu Outdated Show resolved Hide resolved
@asmorkalov asmorkalov merged commit d05fb70 into opencv:4.x Nov 21, 2023
26 checks passed
@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
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.

None yet

3 participants