Python Stochastic Gradient Sub Sandwich