parameters: (self, session, weights='last')
docstring: :param session:
          :param weights: 'last' or 'best'
          :return:
function: def load(self, session, weights='last'):
          """
  
          :param session:
          :param weights: 'last' or 'best'
          :return:
          """
          if os.path.exists(self.scores_file):
              scores = []
              with open(self.scores_file, 'r') as f:
                  for line in f:
                      scores.append(float(line))
  
              self.scores = scores
              op = max if not self.less_is_better else min
              self.best_score = op(scores)
              self.best_epoch = scores.index(self.best_score) + 1
              self.recorded_epochs = len(scores)
  
          restore_path = '{}-{}'.format(
              self.checkpoint_file,
              self.recorded_epochs if weights == 'last' else self.best_epoch
          )
          if os.path.exists(restore_path) or os.path.exists('{}.index'.format(restore_path)):
              self.saver.restore(session, restore_path)
          else:
              self.logger.debug('Could not restore weights. Path does not exist: {}'.format(restore_path))
function_tokens: def load ( self , session , weights = 'last' ) : if os . path . exists ( self . scores_file ) : scores = [ ] with open ( self . scores_file , 'r' ) as f : for line in f : scores . append ( float ( line ) ) self . scores = scores op = max if not self . less_is_better else min self . best_score = op ( scores ) self . best_epoch = scores . index ( self . best_score ) + 1 self . recorded_epochs = len ( scores ) restore_path = '{}-{}' . format ( self . checkpoint_file , self . recorded_epochs if weights == 'last' else self . best_epoch ) if os . path . exists ( restore_path ) or os . path . exists ( '{}.index' . format ( restore_path ) ) : self . saver . restore ( session , restore_path ) else : self . logger . debug ( 'Could not restore weights. Path does not exist: {}' . format ( restore_path ) )