Implemented GradientBase class.