Solved by ptrblck in post #3 
              
              
                I think it’s related to the multiprocessing behavior in Windows. 
You should wrap your whole code in another function and guard it: 
def run():
    for epoch in ...
        train(...)


if __name__=='__main__':
    run()

I’m wondering why you won’t get a Broken Pipe error, which is usually thrown i…