Skip to content

Commit 48ab823

Browse files
committed
add stride check for PoolOutputSize
1 parent fd5b8ee commit 48ab823

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

paddle/phi/kernels/funcs/pooling.h

+7
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,13 @@ inline int PoolOutputSize(int input_size,
371371
int padding_2,
372372
int stride,
373373
bool ceil_mode) {
374+
PADDLE_ENFORCE_NE(
375+
stride,
376+
0,
377+
phi::errors::InvalidArgument(
378+
"The stride of PoolOutputSize shall not be 0, but received %d.",
379+
stride));
380+
374381
int output_size;
375382
if (!ceil_mode) {
376383
output_size =

0 commit comments

Comments
 (0)