added gradient clipping, option to opt out of max_norm during optimization