提交 562945c9 编写于 作者: X xiemoyuan

iCafe 9009: Optimize the error message of OP.

上级 827ac36f
......@@ -22,18 +22,19 @@ class GatherTreeOp : public framework::OperatorWithKernel {
using framework::OperatorWithKernel::OperatorWithKernel;
void InferShape(framework::InferShapeContext* ctx) const override {
PADDLE_ENFORCE(ctx->HasInput("Ids"),
"Input(Ids) of GatherTreeOp should not be null.");
PADDLE_ENFORCE(ctx->HasInput("Parents"),
"Input(Parents) of GatherTreeOp should not be null.");
PADDLE_ENFORCE(ctx->HasOutput("Out"),
"Output(Out) of GatherTreeOp should not be null.");
PADDLE_ENFORCE_EQ(ctx->HasInput("Ids"), true,
"Input(Ids) of GatherTreeOp should not be null.");
PADDLE_ENFORCE_EQ(ctx->HasInput("Parents"), true,
"Input(Parents) of GatherTreeOp should not be null.");
PADDLE_ENFORCE_EQ(ctx->HasOutput("Out"), true,
"Output(Out) of GatherTreeOp should not be null.");
auto ids_dims = ctx->GetInputDim("Ids");
auto parents_dims = ctx->GetInputDim("Parents");
PADDLE_ENFORCE(ids_dims == parents_dims,
"The shape of Input(Parents) must be same with the shape of "
"Input(Ids).");
PADDLE_ENFORCE_EQ(
ids_dims == parents_dims, true,
"The shape of Input(Parents) must be same with the shape of "
"Input(Ids).");
ctx->SetOutputDim("Out", ids_dims);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册