I have set n_bptt_steps to 2, hence it always goes into that loop. And I just noticed that the first iteration of the outer loop works fine, but it throws that error in the second iteration(i.e. s=1). Do you know why that maybe? I’m sorry if these questions as silly, but I’m pretty new to pytorch.