fixed up gradient descent with generators