If you want to be able to run inference in batches, you have to normalize to a given input size. It often means a square input size if you want to minimally distort both vertical and horizontal images.
You can also use variable input shape in production if you need to. It will be harder to optimize, especially for throughput, but it's not impossible.