diff --git a/paddle/fluid/operators/warpctc_cudnn_op.cu.cc b/paddle/fluid/operators/warpctc_cudnn_op.cu.cc index 2c0f9b89a8edbd288355a3b2e5113b469694a2ae..5e16a209e712a143e1083e171f88002817aef838 100644 --- a/paddle/fluid/operators/warpctc_cudnn_op.cu.cc +++ b/paddle/fluid/operators/warpctc_cudnn_op.cu.cc @@ -144,6 +144,8 @@ class CudnnCTCKernel : public framework::OpKernel { CUDNN_CTC_LOSS_ALGO_DETERMINISTIC, cu_ctcloss_desc, &workspace_size)); T* loss_data = loss->mutable_data(loss_dims, ctx.GetPlace()); + math::SetConstant()( + ctx.template device_context(), loss, static_cast(0)); auto temp_allocation = platform::DeviceTemporaryAllocator::Instance().Get(dev_ctx).Allocate(