From 99369d43b61fa3f6e6b8a7a5da24a0cb6023dfc4 Mon Sep 17 00:00:00 2001 From: dengkaipeng Date: Sat, 2 Mar 2019 18:03:13 +0800 Subject: [PATCH] fix doc. test=develop --- paddle/fluid/operators/kldiv_loss_op.cc | 4 ++-- paddle/fluid/operators/kldiv_loss_op.h | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/paddle/fluid/operators/kldiv_loss_op.cc b/paddle/fluid/operators/kldiv_loss_op.cc index a3254c51c2..be84b57c6f 100644 --- a/paddle/fluid/operators/kldiv_loss_op.cc +++ b/paddle/fluid/operators/kldiv_loss_op.cc @@ -48,7 +48,7 @@ class KLDivLossOp : public framework::OperatorWithKernel { if ("none" == reduction) { ctx->SetOutputDim("Loss", dim_x); } else { - ctx->SetOutputDim("Loss", framework::make_ddim({1})); + ctx->SetOutputDim("Loss", {1}); } } @@ -81,7 +81,7 @@ class KLDivLossOpMaker : public framework::OpProtoAndCheckerMaker { "The reduction type to apply to the output, available types " "are 'none' | 'batchmean' | 'mean' | 'sum', 'none' for no " "reduction, 'batchmean' for the sum of output divided by " - "batchmean size, 'mean' for the average valud of all output, " + "batch size, 'mean' for the average valud of all output, " "'sum' for the sum of the output.") .SetDefault("mean"); diff --git a/paddle/fluid/operators/kldiv_loss_op.h b/paddle/fluid/operators/kldiv_loss_op.h index f262cfbb5f..625e16e298 100644 --- a/paddle/fluid/operators/kldiv_loss_op.h +++ b/paddle/fluid/operators/kldiv_loss_op.h @@ -104,7 +104,8 @@ class KLDivLossGradKernel : public framework::OpKernel { auto loss_grad_expand = loss_grad_t.broadcast(Array1(expand)); auto grad_t = target_t * loss_grad_expand; - input_grad_t.device(place) = target_t.binaryExpr(grad_t, KLDivLossBackward()); + input_grad_t.device(place) = + target_t.binaryExpr(grad_t, KLDivLossBackward()); if ("mean" == reduction) { input_grad_t.device(place) = input_grad_t / static_cast(numel); -- GitLab