From 904a762c627feec009928627e92cb403b31f9e12 Mon Sep 17 00:00:00 2001 From: yukavio Date: Mon, 28 Sep 2020 01:50:32 +0000 Subject: [PATCH] fix generate_proposals and affine grid error info --- .../operators/affine_grid_cudnn_op.cu.cc | 35 +++++++++++-------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/paddle/fluid/operators/affine_grid_cudnn_op.cu.cc b/paddle/fluid/operators/affine_grid_cudnn_op.cu.cc index a2027e35063..01bf67d6414 100644 --- a/paddle/fluid/operators/affine_grid_cudnn_op.cu.cc +++ b/paddle/fluid/operators/affine_grid_cudnn_op.cu.cc @@ -26,11 +26,12 @@ template class CUDNNAffineGridOpKernel : public framework::OpKernel { public: void Compute(const framework::ExecutionContext& ctx) const override { - PADDLE_ENFORCE_EQ(platform::is_gpu_place(ctx.GetPlace()), true, - platform::errors::InvalidArgument("Only " - "support for CUDAPlace.Please switch " - "your context from CPUPlace to " - "CUDAPlace or update your cudnn."); + PADDLE_ENFORCE_EQ( + platform::is_gpu_place(ctx.GetPlace()), true, + platform::errors::InvalidArgument("Only " + "support for CUDAPlace.Please switch " + "your context from CPUPlace to " + "CUDAPlace or update your cudnn.")); auto& dev_ctx = ctx.template device_context(); auto handle = dev_ctx.cudnn_handle(); auto* theta = ctx.Input("Theta"); @@ -59,10 +60,11 @@ class CUDNNAffineGridOpKernel : public framework::OpKernel { cudnnSpatialTransformerDescriptor_t cudnn_st_desc = st_desc.descriptor(4, h_size_data); - PADDLE_ENFORCE_EQ(platform::dynload::cudnnSpatialTfGridGeneratorForward( - handle, cudnn_st_desc, theta_data, output_data), + PADDLE_ENFORCE_EQ( + platform::dynload::cudnnSpatialTfGridGeneratorForward( + handle, cudnn_st_desc, theta_data, output_data), true, platform::errors::Fatal("Some errors has occurred " - "during forward computation in cudnn.")); + "during forward computation in cudnn.")); } }; @@ -71,10 +73,11 @@ class CUDNNAffineGridGradOpKernel : public framework::OpKernel { public: void Compute(const framework::ExecutionContext& ctx) const override { PADDLE_ENFORCE_EQ(platform::is_gpu_place(ctx.GetPlace()), true, - platform::errors::InvalidArgument("Only " - "support for CUDAPlace. Please switch " - "your context from CPUPlace to " - "CUDAPlace or update your cudnn."); + platform::errors::InvalidArgument( + "Only " + "support for CUDAPlace. Please switch " + "your context from CPUPlace to " + "CUDAPlace or update your cudnn.")); auto& dev_ctx = ctx.template device_context(); auto handle = dev_ctx.cudnn_handle(); auto output_grad = ctx.Input(framework::GradVarName("Output")); @@ -103,9 +106,11 @@ class CUDNNAffineGridGradOpKernel : public framework::OpKernel { const T* output_grad_data = output_grad->data(); T* theta_grad_data = theta_grad->mutable_data(ctx.GetPlace()); - PADDLE_ENFORCE_EQ(platform::dynload::cudnnSpatialTfGridGeneratorBackward( - handle, cudnn_st_desc, output_grad_data, theta_grad_data), - true, "Some errors " + PADDLE_ENFORCE_EQ( + platform::dynload::cudnnSpatialTfGridGeneratorBackward( + handle, cudnn_st_desc, output_grad_data, theta_grad_data), + true, + "Some errors " "has occurred during forward computation in cudnn;"); } }; -- GitLab