Skip to content

How to implement PyTorch's nn.MaxPool2d(2, 1, ceil_mode=True) in Burn? #2740

Answered by laggui
dfsfdfse asked this question in Q&A
Discussion options

You must be logged in to vote

I'm afraid this is not currently supported, iirc ceil_mode might add padding to the right and down of the input (asymmetric, as you point out). So there are two parts to this: 1) asymmetric padding and 2) ceil_mode, both of which are not currently implemented. Asymmetric padding support has to come first (#2676), but feel free to open an issue for ceil mode!

In the meantime, you might be able to manually pad the input with tensor.pad((left, right, top, bottom), value) before applying the maxpool.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by dfsfdfse
Comment options

You must be logged in to vote
1 reply
@laggui
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants