From d54005a7f43af4107aa117fbd517f81c025165b3 Mon Sep 17 00:00:00 2001 From: dengkaipeng Date: Mon, 25 Mar 2019 14:23:05 +0000 Subject: [PATCH] fix unittest. test=develop --- paddle/fluid/operators/softmax_with_cross_entropy_op.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/operators/softmax_with_cross_entropy_op.h b/paddle/fluid/operators/softmax_with_cross_entropy_op.h index ff99e4207a7..2220d77e8a2 100644 --- a/paddle/fluid/operators/softmax_with_cross_entropy_op.h +++ b/paddle/fluid/operators/softmax_with_cross_entropy_op.h @@ -40,10 +40,12 @@ class SoftmaxWithCrossEntropyKernel : public framework::OpKernel { softmax->mutable_data(context.GetPlace()); loss->mutable_data(context.GetPlace()); + int axis_dim = logits->dims()[logits->dims().size()-1]; + auto& dev_ctx = context.template device_context(); math::SoftmaxFunctor()( - dev_ctx, -1, logits, softmax); + dev_ctx, axis_dim, logits, softmax); math::CrossEntropyFunctor()( dev_ctx, loss, softmax, labels, context.Attr("soft_label"), context.Attr("ignore_index")); -- GitLab