Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Random<>::SampleUniform() has inconsistant behaviours on CPU, GPU and docs #213

Open
cairijun opened this issue Feb 15, 2017 · 1 comment

Comments

@cairijun
Copy link

According to docs, Random<>::SampleUniform(&dst, a, b) should generate random samples uniformly distributed in [a, b).

However, when DType = float, std::uniform_real_distribution, which is used internally in SampleUniform for CPU, might accidentally return b. This is an issue in most stdlib implementations. See LWG#2524, GCC#63176, LLVM#18767.

On GPU, curandGenerateUniform() is used, but it actually produces samples in (0, 1] according its documentation:

Results are 32-bit floating point values between 0.0f and 1.0f, excluding 0.0f and including 1.0f.

which results in (a, b] for SampleUniform(). The same issue affects double version as well.

@szha
Copy link
Member

szha commented Aug 4, 2019

This code base has been donated to the Apache MXNet project per #373, and repo is deprecated. Future development and issue tracking should continue in Apache MXNet.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants