Hi,
The problem is that your self.state is kept across iterations. And so the computational graph for the second call actually includes the one from the first call.
You mist likely want to either reset your state. Or .detach() to avoid doing so.