Do image height and width have to be always the same for CNN?

In Course 4 U_Net assignment, the image dimensions are:

img_height = 96
img_width = 128
num_channels = 3

In all other cases in the lecture, the images are always in size of n * n * 3, meaning that height and weight are the same. But why is it different in this project? In practice, most images’ heights and widths are different of course. So my question is, why is it n * n * 3 in most other cases?

I think this just means that we can use both square images and rectangular images in CNN.

It’s rather traditional for NN image processing examples to use square images, but there’s no reason it must be so.

Most NN image projects will rescale the original images to smaller sizes, in order to reduce the number of features that the NN needs to handle.

All examples in the lectures are square images, and also most of the image datasets use square images, i.e. MNIST?

That is interesting, but not motivating enough for me to conclude to what you have put in the title of this thread. Is there any CNN technique that you have learnt requiring us to use square images?