未验证 提交 60bfd308 编写于 作者: Z Zhong Hui 提交者: GitHub

fix p_norm with empty shape (#29500)

fix p_norm with empty shape (#29500)
上级 b9e926b8
...@@ -116,6 +116,9 @@ class PnormOp : public framework::OperatorWithKernel { ...@@ -116,6 +116,9 @@ class PnormOp : public framework::OperatorWithKernel {
for (int i = 0; i < x_dim.size(); ++i) { for (int i = 0; i < x_dim.size(); ++i) {
if (i != axis) reduce_dims.emplace_back(x_dim[i]); if (i != axis) reduce_dims.emplace_back(x_dim[i]);
} }
if (reduce_dims.size() == 0) {
reduce_dims.emplace_back(1);
}
} }
x_dim[axis] = 1; x_dim[axis] = 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册