Fixed direction of gradient on CPU graph