Thank you for your reply, but I need to accommodate for the pooling layer needs to have an output size of b x c x (1,1) but it could be b x c x (1,5) or b x c x (1,10)
Or you suggest I set the output shape dynamically in each forward pass?