Skip to content

Commit

Permalink
add stride check for PoolOutputSize
Browse files Browse the repository at this point in the history
  • Loading branch information
RedContritio committed Feb 1, 2023
1 parent fd5b8ee commit 48ab823
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions paddle/phi/kernels/funcs/pooling.h
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,13 @@ inline int PoolOutputSize(int input_size,
int padding_2,
int stride,
bool ceil_mode) {
PADDLE_ENFORCE_NE(
stride,
0,
phi::errors::InvalidArgument(
"The stride of PoolOutputSize shall not be 0, but received %d.",
stride));

int output_size;
if (!ceil_mode) {
output_size =
Expand Down

0 comments on commit 48ab823

Please sign in to comment.