diff --git a/paddle/fluid/operators/sampling_id_op.h b/paddle/fluid/operators/sampling_id_op.h index 7ad25fa13ae8ace963dba5c66a57118e4267737e..7f3ca8e761cc252b21a83e9be57d0639801734d7 100644 --- a/paddle/fluid/operators/sampling_id_op.h +++ b/paddle/fluid/operators/sampling_id_op.h @@ -72,11 +72,11 @@ class SamplingIdKernel : public framework::OpKernel { // Standard mersenne_twister_engine seeded with rd() std::mt19937 gen(rd()); std::uniform_real_distribution<> dis(0, 1); - rnd = std::bind(dis, gen); + rnd = std::bind(dis, std::ref(gen)); } static std::once_flag init_flag_; - static std::function<> rnd; + static std::function rnd; }; } // namespace operators } // namespace paddle