I need clarification on pads in Maxpool. In the example here (maxpool_2d_pads) pads are mentioned as pad_bottom , pad_top , pad_right , pad_left, and in the attached screenshot pads are (0,0,1,1). Are the pads mentioned in the format (pad_bottom , pad_top , pad_right , pad_left)? If not, what is the right interpretation?

- 970
- 6
- 25
1 Answers
From the definition of the pads for MaxPool here
pads : list of ints ...
pads
format should be as follow [x1_begin, x2_begin...x1_end, x2_end,...], where xi_begin the number of pixels added at the beginning of axisi
and xi_end, the number of pixels added at the end of axisi
. ...
So for your example, the pads are in the format [pad_top, pad_left, pad_bottom, pad_right]
This following part is copied from the answer from user2008981 below,
The pads are in order of the spatial axes of the X input. The X input has dimensions N x C x H x W when rank 4 (per the docs). So the spatial dimensions are x1=H (vertical) then x2=W (horizontal). Horizontal goes left to right, vertical goes top to bottom. x1_begin=top, x2_begin=left, x1_end=bottom, x2_end=right.

- 456
- 4
- 6
-
Can you explain little more on how did you derive that? – harry Sep 03 '21 at 22:20
-
1The pads are in order of the spatial axes of the X input. The X input has dimensions `N x C x H x W` when rank 4 (per the docs). So the spatial dimensions are x1=H (vertical) then x2=W (horizontal). Horizontal goes left to right, vertical goes top to bottom. x1_begin=top, x2_begin=left, x1_end=bottom, x2_end=right. – user2008981 Sep 03 '21 at 22:52
-
Please provide additional details in your answer. As it's currently written, it's hard to understand your solution. – Community Sep 04 '21 at 04:44