Skip to content

Commit c2a3701

Browse files
authored
[rc4] add a early fail check for maxpool2d when input is 3d under ceil mode (#2577)
* [rc4] add a early fail check for maxpool2d when input is 3d under ceil mode Signed-off-by: Chen, Zejun <[email protected]>
1 parent 9a40718 commit c2a3701

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

csrc/gpu/aten/operators/DilatedMaxPool2d.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ void max_pool2d_with_indices_out_template(
5454
IntArrayRef padding,
5555
IntArrayRef dilation,
5656
bool ceil_mode) {
57+
if (ceil_mode) {
58+
TORCH_CHECK(
59+
(input.ndimension() == 4),
60+
"For now, the max pool2d only support 4d input for ceil mode");
61+
}
62+
5763
TORCH_CHECK(
5864
kernel_size.size() == 1 || kernel_size.size() == 2,
5965
"max_pool2d: kernel_size must either be a single int, or a tuple "

0 commit comments

Comments
 (0)