gradient based optimizer now with vector support