Since the input shapes are not statically defined, you would have to set the padding size manually to get the same output size.
You can find some convenience methods to calculate the padding for a specific input shapes here in the forum.