I have a dataset of around 4k images. I am iterating over that dataset approximately 1000 times (epochs). I am wondering, what is more efficient and leads to better generalization - calculating loss and doing 1 backpropagation per image or averaging out all losses from one epoch and then backpropagating?