From 14fb15b68530981cb9c4e30c44d375ccca82b0b3 Mon Sep 17 00:00:00 2001 From: wanghaoshuang Date: Tue, 19 Sep 2017 23:40:22 +0800 Subject: [PATCH] Remove const cast for device context --- paddle/operators/clip_op.cu | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/paddle/operators/clip_op.cu b/paddle/operators/clip_op.cu index 883f25c92..ac6a062f6 100644 --- a/paddle/operators/clip_op.cu +++ b/paddle/operators/clip_op.cu @@ -54,12 +54,11 @@ class ClipGradientOpCUDAKernel : public framework::OpKernel { int D = d_x->dims()[1]; int block = 512; int grid = (N * D + block - 1) / block; - auto* device_context = - const_cast(context.device_context_); - ClipGradientKernel< - T><<(device_context) - ->stream()>>>(count, min, max, x_data, d_out_data, d_x_data); + ClipGradientKernel<<< + grid, block, 0, reinterpret_cast( + context.device_context()) + .stream()>>>(count, min, max, x_data, d_out_data, + d_x_data); } }; -- GitLab