diff --git a/paddle/fluid/pybind/cuda_streams_py.cc b/paddle/fluid/pybind/cuda_streams_py.cc index df63239cad6d6908db559145bf4553425fc873ee..21c6e0a4f28caa064729f75dda08466e7da14a80 100644 --- a/paddle/fluid/pybind/cuda_streams_py.cc +++ b/paddle/fluid/pybind/cuda_streams_py.cc @@ -164,8 +164,7 @@ void BindCudaStream(py::module *m_ptr) { [](paddle::platform::stream::CUDAStream &self, paddle::platform::CudaEvent *event) { if (event == nullptr) { - auto event_tmp = paddle::platform::CudaEvent(); - event = &event_tmp; + event = new paddle::platform::CudaEvent(); } event->Record(self); return event;