未验证 提交 9c238d2b 编写于 作者: D Difer 提交者: GitHub

fix softmaxce null point in shape test (#51850)

上级 85b2fa4b
......@@ -162,6 +162,13 @@ 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)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册