From 71c1cd14083d785820959494158bbf80c8961654 Mon Sep 17 00:00:00 2001 From: yaoxuefeng Date: Mon, 23 Nov 2020 14:19:59 +0800 Subject: [PATCH] fix truncated_gaussian seed (#28777) --- paddle/fluid/operators/truncated_gaussian_random_op.cu | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/paddle/fluid/operators/truncated_gaussian_random_op.cu b/paddle/fluid/operators/truncated_gaussian_random_op.cu index d4247d9c1d..798709b108 100644 --- a/paddle/fluid/operators/truncated_gaussian_random_op.cu +++ b/paddle/fluid/operators/truncated_gaussian_random_op.cu @@ -109,12 +109,12 @@ class GPUTruncatedGaussianRandomKernel : public framework::OpKernel { thrust::device_ptr(data), TruncatedNormalOffset(mean, std, std::numeric_limits::min(), seed_offset.first, gen_offset)); + } else { + thrust::transform( + index_sequence_begin, index_sequence_begin + size, + thrust::device_ptr(data), + TruncatedNormal(mean, std, std::numeric_limits::min(), seed)); } - - thrust::transform( - index_sequence_begin, index_sequence_begin + size, - thrust::device_ptr(data), - TruncatedNormal(mean, std, std::numeric_limits::min(), seed)); } }; -- GitLab