CUDA memory continuously increases when net(images) called in every iteration

This is because pytorch will build a the graph again and again, and all the intermediate states will be stored.

In training, the states will be cleared if you do backward.
However, during test time, you could use Variable(xxx, volatile=True). I don’t know if it’s your case, because of the weird situation you have.

A good reference is this Understanding graphs and state.