Solved by Tahir in post #2 
              
              
                How about writing your own data loader in a separate thread? This can run in parrallel to your training loop. 
The data loading can look like this (I wrote the data caching in RAM but it can work for parrallel caching in GPU as well, i think): 
(cache_size is the number of images or data to be cache…