Solved by Nikronic in post #5 
              
              
                Hi, 
I am not sure about your code, but there is easier ways to handle it. You can define your custom Dataset class and have all data in each iteration just by setting batch_size=len(data) and you no longer have to change your code for different purposes. And also, you have to implement __len__ func…