'Saves optimizer (updater) state to a file.
Parameters
fname : str
Path to output states file.'

def save_optimizer_states(self, fname):

    assert self.optimizer_initialized
    if self._update_on_kvstore:
        self._kvstore.save_optimizer_states(fname)
    else:
        with open(fname, 'wb') as fout:
            fout.write(self._updater.get_states())
