提交 aac698bb 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!5948 fix sample seed

Merge pull request !5948 from baihuawei/sample-seed
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
#include <random>
#include "multinomial_impl.cuh" #include "multinomial_impl.cuh"
template <typename T> template <typename T>
...@@ -107,7 +108,8 @@ void Multinomial(int seed, T *input, int num_sample, curandState *globalState, i ...@@ -107,7 +108,8 @@ void Multinomial(int seed, T *input, int num_sample, curandState *globalState, i
if (seed != 0) { if (seed != 0) {
RNG_seed = seed; RNG_seed = seed;
} else { } else {
RNG_seed = time(NULL); std::random_device rd;
RNG_seed = static_cast<int>(rd());
} }
int count = distributions * num_sample; int count = distributions * num_sample;
MultinomialKernel<<<GET_BLOCKS(count), GET_THREADS, 0, cuda_stream>>>(RNG_seed, input, num_sample, globalState, MultinomialKernel<<<GET_BLOCKS(count), GET_THREADS, 0, cuda_stream>>>(RNG_seed, input, num_sample, globalState,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册