You can use a custom collate_fn to avoid the automatic batching and return e.g. a list of your input image tensors, which all have a different shape.
However, you wouldn’t be able to pass them as a batch, since you won’t be able to create a single tensor in the shape [batch_size, channels, height, width] due to the different shapes.
You could reshape, pool, etc. the images or pass them sequentially to the model.
There is an ongoing effort of nested tensors, which would accept tensors in different shapes, but I don’t know what the current state is.