From 7333df8510953a0c99a1c0702666ff090c005378 Mon Sep 17 00:00:00 2001 From: QI JUN Date: Thu, 25 Jan 2018 21:16:45 +0800 Subject: [PATCH] fix pool_op bug (#7879) --- paddle/operators/pool_op.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/paddle/operators/pool_op.h b/paddle/operators/pool_op.h index c3d82ecbdeb..d6ba5e298a4 100644 --- a/paddle/operators/pool_op.h +++ b/paddle/operators/pool_op.h @@ -139,10 +139,8 @@ class PoolGradKernel : public framework::OpKernel { auto& dev_ctx = context.template device_context(); if (in_x_grad) { in_x_grad->mutable_data(context.GetPlace()); - auto temp = framework::EigenVector::Flatten(*in_x_grad); - temp.device( - *context.template device_context().eigen_device()) = - temp.constant(static_cast(0)); + paddle::operators::math::SetConstant set_constant; + set_constant(dev_ctx, in_x_grad, 0.0); switch (ksize.size()) { case 2: { -- GitLab