diff --git a/paddle/phi/kernels/gpu/gaussian_random_kernel.cu b/paddle/phi/kernels/gpu/gaussian_random_kernel.cu index d5acc60a36097f02c579671860c0b480199ae09a..da16800ad02af19c19f8d0fd4f776739324e5959 100644 --- a/paddle/phi/kernels/gpu/gaussian_random_kernel.cu +++ b/paddle/phi/kernels/gpu/gaussian_random_kernel.cu @@ -81,22 +81,25 @@ void GaussianRandomKernel(const Context& dev_ctx, int device_id = dev_ctx.GetPlace().GetDeviceId(); auto gen_cuda = paddle::framework::GetDefaultCUDAGenerator(device_id); - using MT = typename phi::kps::details::MPTypeTrait::Type; if (gen_cuda->GetIsInitPy() && seed_flag) { if (FLAGS_use_curand) { + using MT = typename phi::kps::details::MPTypeTrait::Type; funcs::normal_distribution dist; funcs::normal_transform trans(mean, std); funcs::distribution_and_transform(dev_ctx, tensor, dist, trans); } else { auto seed_offset = gen_cuda->IncrementOffset(1); int64_t gen_offset = size * seed_offset.second; - auto func = - GaussianGenerator(mean, std, seed_offset.first, gen_offset); - IndexKernel>(dev_ctx, tensor, func); + auto func = GaussianGenerator(static_cast(mean), + static_cast(std), + seed_offset.first, + gen_offset); + IndexKernel>(dev_ctx, tensor, func); } } else { - auto func = GaussianGenerator(mean, std, seed); - IndexKernel>(dev_ctx, tensor, func); + auto func = + GaussianGenerator(static_cast(mean), static_cast(std), seed); + IndexKernel>(dev_ctx, tensor, func); } }