fix p_norm with empty shape (#29500)

fix p_norm with empty shape (#29500)
revert-31562-mean
Zhong Hui 5 years ago committed by GitHub
parent b9e926b8e5
commit 60bfd308ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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;

Loading…
Cancel
Save