diff --git a/paddle/operators/prelu_op.h b/paddle/operators/prelu_op.h index ece2a836a65e6508580bc32b84f7833388ce55f3..63031c25cc3570cf40440726ea76976953d5417a 100644 --- a/paddle/operators/prelu_op.h +++ b/paddle/operators/prelu_op.h @@ -54,8 +54,8 @@ class PReluKernel : public framework::OpKernel { int numel = x->numel(); - auto place = context.GetPlace(); - Transform(place, x_ptr, x_ptr + numel, o_ptr, PReluFunctor(alpha_ptr)); + Transform(context.device_context(), x_ptr, x_ptr + numel, o_ptr, + PReluFunctor(alpha_ptr)); } }; @@ -91,9 +91,8 @@ class PReluGradKernel : public framework::OpKernel { const T* out_ptr = out->data(); int numel = dx->numel(); - auto place = context.GetPlace(); - Transform(place, out_ptr, out_ptr + numel, dout_ptr, dx_ptr, - PReluGradFunctor(alpha_ptr)); + Transform(context.device_context(), out_ptr, out_ptr + numel, dout_ptr, + dx_ptr, PReluGradFunctor(alpha_ptr)); // TODO (Zhuoyuan): add dalpha upgrade when GPU kernels ready }