Someone from Stackoverflow recommended to me to post my question here:
I’m getting a runtime error everytime I try to debug pytorch code for the second time. It seems like after restarting the ipython console some of the cuda programs are not canceled properly so that this error occurs while trying to rerun the code. Has anyone had the same experience / knows how to solve it? Is there a way to manually flush all cuda activities from my GPU?
I’m using

pytorch version 0.1.12_1
ipython 4.2.0
as IDE spyder 3.2.4.
cuda 8.0
Titan X (pascal)

Alternatively: Can someone tell me a working combination of pytorch / ipython / spyder versions? Maybe mine is simply buggy.