I don’t think the issue is caused by Resize, but seems to be delayed for smaller shapes.



 mathwseg:

the code keeps working more … but stop and didn’t complete all images I have


This indicates that your script is increasing the memory usage in each iteration, which could be caused by e.g. storing the model output or loss in a list without detaching them.
Check the memory usage via nvidia-smi or torch.cuda.memory_summar() in each iteration and you would most likely see an increase in each step.