gradient optimizer updated to new style