提交 5309b081 编写于 作者: P phlrain

simple code; test=develop

上级 766c8681
...@@ -111,11 +111,8 @@ class SoftmaxWithCrossEntropyOp : public framework::OperatorWithKernel { ...@@ -111,11 +111,8 @@ class SoftmaxWithCrossEntropyOp : public framework::OperatorWithKernel {
PADDLE_ENFORCE_EQ( PADDLE_ENFORCE_EQ(
rank, labels_dims.size(), rank, labels_dims.size(),
"Input(logits) and Input(Label) shall have the same rank."); "Input(logits) and Input(Label) shall have the same rank.");
bool check = true; bool check = ctx->IsRuntime() || (framework::product(logits_dims) > 0 &&
if ((!ctx->IsRuntime()) && (framework::product(logits_dims) <= 0 || framework::product(labels_dims) > 0);
framework::product(labels_dims) <= 0)) {
check = false;
}
if (check) { if (check) {
PADDLE_ENFORCE_EQ(framework::slice_ddim(logits_dims, 0, rank - 1), PADDLE_ENFORCE_EQ(framework::slice_ddim(logits_dims, 0, rank - 1),
framework::slice_ddim(labels_dims, 0, rank - 1), framework::slice_ddim(labels_dims, 0, rank - 1),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册