Skip to content

Commit 9c238d2

Browse files
authored
fix softmaxce null point in shape test (#51850)
1 parent 85b2fa4 commit 9c238d2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

paddle/fluid/operators/softmax_with_cross_entropy_op.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,13 @@ class SoftmaxWithCrossEntropyOp : public framework::OperatorWithKernel {
162162
"R is the rank of Input(Logits)."));
163163

164164
axis = phi::funcs::CanonicalAxis(axis, logits_rank);
165+
166+
PADDLE_ENFORCE_EQ(logits_dims.size(),
167+
labels_dims.size(),
168+
platform::errors::InvalidArgument(
169+
"Input(Logits) and Input(Label) should in "
170+
"same dimensions size."));
171+
165172
for (int i = 0; i < logits_rank; i++) {
166173
if (i != axis) {
167174
if (ctx->IsRuntime() || (logits_dims[i] > 0 && labels_dims[i] > 0)) {

0 commit comments

Comments
 (0)