Updated training object and SGD to cache and resuse the sgd_update function.