(self, global_step=None)
return saver
Get the saver.
Get the saver.
Get the saver .
def get_saver(self, global_step=None):
    """Get the saver."""
    solverconf = self.config['solver']
    max_to_keep = solverconf['saver']['max_to_keep']
    model_avg_conf = self.config['solver']['model_average']
    model_average = model_avg_conf['enable']
    if model_average:
      var_avg_decay = model_avg_conf['var_avg_decay']
      variable_averages = self.get_var_avg_ema(var_avg_decay, global_step)
      variable_to_restore = variable_averages.variables_to_restore()
      logging.info('Restore: name to var : {}'.format(variable_to_restore))
      saver = tf.train.Saver(variable_to_restore, max_to_keep=max_to_keep)
      logging.info('Restore vars from moving variables')
    else:
      saver = tf.train.Saver(max_to_keep=max_to_keep)
    return saver
def get_saver ( self , global_step = None ) : solverconf = self . config [ 'solver' ] max_to_keep = solverconf [ 'saver' ] [ 'max_to_keep' ] model_avg_conf = self . config [ 'solver' ] [ 'model_average' ] model_average = model_avg_conf [ 'enable' ] if model_average : var_avg_decay = model_avg_conf [ 'var_avg_decay' ] variable_averages = self . get_var_avg_ema ( var_avg_decay , global_step ) variable_to_restore = variable_averages . variables_to_restore ( ) logging . info ( 'Restore: name to var : {}' . format ( variable_to_restore ) ) saver = tf . train . Saver ( variable_to_restore , max_to_keep = max_to_keep ) logging . info ( 'Restore vars from moving variables' ) else : saver = tf . train . Saver ( max_to_keep = max_to_keep ) return saver