diff --git a/paddle/fluid/operators/softmax_with_cross_entropy_op.cc b/paddle/fluid/operators/softmax_with_cross_entropy_op.cc index c093078fae0efe2dac4d59e5313d8152271b664f..df142f3350c0e7e4f31ba0f525e1f39a091a1b95 100644 --- a/paddle/fluid/operators/softmax_with_cross_entropy_op.cc +++ b/paddle/fluid/operators/softmax_with_cross_entropy_op.cc @@ -162,13 +162,6 @@ class SoftmaxWithCrossEntropyOp : public framework::OperatorWithKernel { "R is the rank of Input(Logits).")); axis = phi::funcs::CanonicalAxis(axis, logits_rank); - - PADDLE_ENFORCE_EQ(logits_dims.size(), - labels_dims.size(), - platform::errors::InvalidArgument( - "Input(Logits) and Input(Label) should in " - "same dimensions size.")); - for (int i = 0; i < logits_rank; i++) { if (i != axis) { if (ctx->IsRuntime() || (logits_dims[i] > 0 && labels_dims[i] > 0)) {