Suppose I have 9 images that have to be processed by a neural network NN. I have two choices.

Sequentially process 9 images by NN one after the another with batch dim 1.
Stack all images along the batch dimension  i.e batch size becomes 9.

Certainly, the output for each  image remains the same in the two cases but which is better in terms of execution time and memory consumption.
Does the answer vary w.r.t to execution on CPU and GPU?
Here I am just concerned about inference statistics i.e NN will run with torch.no_grad() wrapper.