1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-21 19:33:03 +04:00

Merge pull request #28080 from nklskyoy:rotary-embedding-experiment-win-32bit

Resolving failing tests of rotary embedding layer on win32 #28080

### 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
- [ ] 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
This commit is contained in:
nklskyoy
2025-11-28 10:31:43 +01:00
committed by GitHub
parent d771165f9d
commit 65b2fa9c2b
@@ -12,7 +12,7 @@ namespace cv { namespace dnn {
static void gather(
const uchar* data, const size_t* pos_ids,
const uchar* data, const int64_t* pos_ids,
const int batch_size, const int seq_len, const int seq_len_max,
const int dhalf, const int elem_size,
uchar* out
@@ -26,7 +26,7 @@ static void gather(
const int t = i % seq_len;
const int b = i / seq_len;
size_t pos_id = pos_ids[b * seq_len + t];
int64_t pos_id = pos_ids[b * seq_len + t];
if (pos_id >= seq_len_max)
{
outOfRangeIdx = true;
@@ -320,7 +320,7 @@ class RotaryEmbeddingLayerImpl CV_FINAL : public RotaryEmbeddingLayer {
for (int i = 0; i < 2; ++i)
{
gather(
caches[i]->ptr<uchar>(), position_ids.ptr<size_t>(),
caches[i]->ptr<uchar>(), position_ids.ptr<int64_t>(),
batch_size, seq_len, seq_len_max,
dhalf, sizeof(float),
internals[i].ptr<uchar>()