Skip to content

Commit

Permalink
fix infer shapes of pool_with_index (#40139)
Browse files Browse the repository at this point in the history
* dbg pool infer shapes

* dbg

* fix format
  • Loading branch information
weisy11 authored Mar 7, 2022
1 parent 55a3bfb commit 0fb6bca
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions paddle/fluid/operators/pool_with_index_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,12 @@ class MaxPoolWithIndexOp : public framework::OperatorWithKernel {
output_shape.insert(output_shape.end(), ksize.begin(), ksize.end());
} else {
for (size_t i = 0; i < ksize.size(); ++i) {
output_shape.push_back(MaxPoolOutputSize(in_x_dims[i + 2], ksize[i],
paddings[i], strides[i]));
if ((!ctx->IsRuntime()) && (in_x_dims[i + 2] < 0)) {
output_shape.push_back(in_x_dims[i + 2]);
} else {
output_shape.push_back(MaxPoolOutputSize(in_x_dims[i + 2], ksize[i],
paddings[i], strides[i]));
}
}
}
ctx->SetOutputDim("Out", phi::make_ddim(output_shape));
Expand Down

0 comments on commit 0fb6bca

Please sign in to comment.