From 8a101524da81b5ec11a69a13fab93ddeea64dd17 Mon Sep 17 00:00:00 2001 From: baihuawei Date: Wed, 9 Sep 2020 15:00:26 +0800 Subject: [PATCH] fix seed --- .../backend/kernel_compiler/gpu/cuda_impl/multinomial_impl.cu | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mindspore/ccsrc/backend/kernel_compiler/gpu/cuda_impl/multinomial_impl.cu b/mindspore/ccsrc/backend/kernel_compiler/gpu/cuda_impl/multinomial_impl.cu index c1cbefe31..287741396 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/gpu/cuda_impl/multinomial_impl.cu +++ b/mindspore/ccsrc/backend/kernel_compiler/gpu/cuda_impl/multinomial_impl.cu @@ -14,6 +14,7 @@ * limitations under the License. */ +#include #include "multinomial_impl.cuh" template @@ -107,7 +108,8 @@ void Multinomial(int seed, T *input, int num_sample, curandState *globalState, i if (seed != 0) { RNG_seed = seed; } else { - RNG_seed = time(NULL); + std::random_device rd; + RNG_seed = static_cast(rd()); } int count = distributions * num_sample; MultinomialKernel<<>>(RNG_seed, input, num_sample, globalState, -- GitLab