fixed gradient nonlinearities implementation