Seems that this cannot be done by current modules/functions, but after reading the code, I find that it is easy to implement, e.g in F. adaptive_max_pool2d, calculate true output_size based on input.size()