Solved by albanD in post #20 
              
              
                Here are three equivalent code, with different runtime/memory comsumption. 
Assume that you want to run sgd with a batch size of 100. 
(I didn’t run the code below there might be some typos, sorry in advance) 
1: single batch of 100 (least runtime, more memory) 
# some code
# Initialize dataset with…