Oops. Updating missing gradient code from generator.