diff --git a/paddle/fluid/operators/huber_loss_op.h b/paddle/fluid/operators/huber_loss_op.h index 666500ef26ea2f0500d898407583a63e27d3991a..9efda3dfc9871f197e0a66329772df2caedc4da4 100644 --- a/paddle/fluid/operators/huber_loss_op.h +++ b/paddle/fluid/operators/huber_loss_op.h @@ -104,19 +104,15 @@ class HuberLossGradKernel : public framework::OpKernel { if (out0) { out0->mutable_data(context.GetPlace()); auto x_grad = EigenVector::Flatten(*out0); - // MSVC not treat it well when partial template arguments were specified x_grad.device(place) = - out_grad * - residual.unaryExpr(HuberLossBackward(delta, static_cast(-1.0))); + out_grad * residual.unaryExpr(HuberLossBackward(delta, -1.0)); } if (out1) { out1->mutable_data(context.GetPlace()); auto y_grad = EigenVector::Flatten(*out1); - // MSVC not treat it well when partial template arguments were specified y_grad.device(place) = - out_grad * - residual.unaryExpr(HuberLossBackward(delta, static_cast(1.0))); + out_grad * residual.unaryExpr(HuberLossBackward(delta, 1.0)); } } };