Before starting the “for” loop, the memory usage is as follows:

SMI_Before_For.PNG1524×422 17.2 KB

Stopping the first iteration before entering the line “loss.backward()” results in the following memory usage:

SMI_Before_backward.PNG1556×362 15.6 KB

After the line “loss.backward()”, the known “out of memory” error is shown.
Decreasing the batch size to “2” allows me to run through the first iteration, but the “out of memory” error is then shown during the second iteration (the same holds for a batch size of 1…).
Is it possible that the 4GB RAM available cannot handle such a small batch size (with RGB pictures of 224X224)?
Thanks!