xaotic:

there is finally no continuing process inside my ipython notebook


Are you restarting the Python kernel inside the notebook or are you running all cells and “wait” in the last cell?
In the latter case, the Python kernel would be still alive and you would be able to write new code in the next cell and execute it. PyTorch uses a caching allocator, which tries to reuse the memory instead of reallocating and freeing it (which would be slow), which could explain the memory usage in case the kernel is still alive.