Solved by Abhilash_Srivastava in post #2 
              
              
                The reason for these two are inter-connected. 

If you see in the for loop: for i in range(0, data_source.size(0) - 1, args.bptt):, the loop goes for length - 1 times. 

Think of a situation where one batch is NOT full. So, for args.bptt = 32, say we have just 17 examples in one batch. In that case,…