Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork56.4k
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
base:4.x
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Changes from1 commit
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -67,16 +67,22 @@ class RandomNormalLikeLayerImpl CV_FINAL : public Layer | ||
| Mat& out = outputs[0]; | ||
| RNG seededRng; | ||
| RNG* rng = &theRNG(); | ||
| if (hasSeed) | ||
| { | ||
| seededRng = RNG(static_cast<uint64>(seed)); | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? | ||
| rng = &seededRng; | ||
| } | ||
Comment on lines +72 to +76 Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
| } | ||
| else | ||
| { | ||
| Mat tmp(out.size.dims(), out.size.p, CV_32F); | ||
| rng->fill(tmp, RNG::NORMAL, mean, scale); | ||
| tmp.convertTo(out, out.type()); | ||
| } | ||
| } | ||