From 85b839f0f17725adbfed3fcaacfd6a7e631e0655 Mon Sep 17 00:00:00 2001 From: emailweixu Date: Mon, 13 Nov 2017 23:39:20 -0800 Subject: [PATCH] Fix l1_norm_op and squared_l2_norm_op for debug mode (#5560) --- paddle/operators/l1_norm_op.h | 2 +- paddle/operators/squared_l2_norm_op.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/paddle/operators/l1_norm_op.h b/paddle/operators/l1_norm_op.h index de459818ad8..3c60dc3dc74 100644 --- a/paddle/operators/l1_norm_op.h +++ b/paddle/operators/l1_norm_op.h @@ -29,7 +29,7 @@ class L1NormKernel : public framework::OpKernel { Out->mutable_data(context.GetPlace()); auto x = framework::EigenVector::Flatten(*X); - auto out = framework::EigenVector::Flatten(*Out); + auto out = framework::EigenScalar::From(*Out); auto place = context.GetEigenDevice(); out.device(place) = x.abs().sum(); diff --git a/paddle/operators/squared_l2_norm_op.h b/paddle/operators/squared_l2_norm_op.h index c8d37ac40c1..48d7b1c2d56 100644 --- a/paddle/operators/squared_l2_norm_op.h +++ b/paddle/operators/squared_l2_norm_op.h @@ -29,7 +29,7 @@ class SquaredL2NormKernel : public framework::OpKernel { Out->mutable_data(context.GetPlace()); auto x = framework::EigenVector::Flatten(*X); - auto out = framework::EigenVector::Flatten(*Out); + auto out = framework::EigenScalar::From(*Out); auto place = context.GetEigenDevice(); out.device(place) = x.square().sum(); -- GitLab