提交 01eda557 编写于 作者: P phlrain

fix bpr loss; test=developp

上级 4267a81a
...@@ -32,10 +32,14 @@ class BprLossOp : public framework::OperatorWithKernel { ...@@ -32,10 +32,14 @@ class BprLossOp : public framework::OperatorWithKernel {
int rank = x_dims.size(); int rank = x_dims.size();
PADDLE_ENFORCE_EQ(rank, label_dims.size(), PADDLE_ENFORCE_EQ(rank, label_dims.size(),
"Input(X) and Input(Label) shall have the same rank."); "Input(X) and Input(Label) shall have the same rank.");
PADDLE_ENFORCE_EQ(framework::slice_ddim(x_dims, 0, rank - 1),
framework::slice_ddim(label_dims, 0, rank - 1), if (ctx->IsRuntime() || (framework::product(x_dims) > 0 &&
"Input(X) and Input(Label) shall have the same shape " framework::product(label_dims) > 0)) {
"except the last dimension."); PADDLE_ENFORCE_EQ(framework::slice_ddim(x_dims, 0, rank - 1),
framework::slice_ddim(label_dims, 0, rank - 1),
"Input(X) and Input(Label) shall have the same shape "
"except the last dimension.");
}
auto y_dims = x_dims; auto y_dims = x_dims;
y_dims[rank - 1] = 1; y_dims[rank - 1] = 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册