@albanD  @Fisher
I found above code will lead to out of memory error as :
RuntimeError: CUDA out of memory. Tried to allocate 1024.00 KiB (GPU 0; 3.95 GiB total capacity; 231.38 MiB already allocated; 6.25 MiB free; 2.52 GiB cached)


Why can not the pytorch re-use the cache memory?