Solved by jberez in post #2 
              
              
                I found my problem… As I was using the wrong index for selection of my minibatches, at loop 24 I would run out of samples to select. Switching the “i” for “j” in the inner training loop should fix it. 
For anyone who encounters this error in the future, perhaps it’s an indexing problem.