Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Added randomNormalLike layer to 4.x branch#28164

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
abhishek-gola wants to merge4 commits intoopencv:4.x
base:4.x
Choose a base branch
Loading
fromabhishek-gola:randomNormalLike_layer_4x
Open
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
Fixed RNG code
  • Loading branch information
@abhishek-gola
abhishek-gola committedDec 15, 2025
commitcf20bf3c4cf7076a9f378c7119865406f937b80c
12 changes: 9 additions & 3 deletionsmodules/dnn/src/layers/randomnormallike_layer.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -67,16 +67,22 @@ class RandomNormalLikeLayerImpl CV_FINAL : public Layer

Mat& out = outputs[0];

RNG rng = hasSeed ? RNG(seed) : theRNG();
RNG seededRng;
RNG* rng = &theRNG();
if (hasSeed)
{
seededRng = RNG(static_cast<uint64>(seed));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I don't quite like that seed is rounded to unsigned integer before passing to RNG. That is, if I pass seed 1.1 and then 1.2, I will get the same results even though the seed has different values. Can we use the following approach instead?

Cvt64suf u;u.f = seed;seededRng = RNG(u.u);rng = &seededRng;

rng = &seededRng;
}
Comment on lines +72 to +76
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

It forces seed on each forward call. it means that forward will return the same sequence each time. Is it expected behaviour?


if (out.depth() == CV_32F || out.depth() == CV_64F || out.depth() == CV_16F)
{
rng.fill(out, RNG::NORMAL, mean, scale);
rng->fill(out, RNG::NORMAL, mean, scale);
}
else
{
Mat tmp(out.size.dims(), out.size.p, CV_32F);
rng.fill(tmp, RNG::NORMAL, mean, scale);
rng->fill(tmp, RNG::NORMAL, mean, scale);
tmp.convertTo(out, out.type());
}
}
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp