original_docstring: Restore all variables in graph with the latest version
docstring: Restore all variables in graph with the latest version
docstring_tokens: Restore all variables in graph with the latest version
code: def restore(self, save_dir, restore_iter=-1):
          """Restore all variables in graph with the latest version"""
          self.logger.info("Restoring model starts...")
          saver = tf.train.Saver()
          checkpoint = tf.train.latest_checkpoint(save_dir)
  
          if restore_iter==-1:
              self.start_iter = int(os.path.basename(checkpoint)[len('model')+1:])
          else:
              self.start_iter = restore_iter
              checkpoint = save_dir+'model-%d'%restore_iter
          self.logger.info("Restoring from {}".format(checkpoint))
          self.generate_sess()
          saver.restore(self.sess, checkpoint)
          self.logger.info("Restoring model done.")
code_tokens: def restore ( self , save_dir , restore_iter = - 1 ) : self . logger . info ( "Restoring model starts..." ) saver = tf . train . Saver ( ) checkpoint = tf . train . latest_checkpoint ( save_dir ) if restore_iter == - 1 : self . start_iter = int ( os . path . basename ( checkpoint ) [ len ( 'model' ) + 1 : ] ) else : self . start_iter = restore_iter checkpoint = save_dir + 'model-%d' % restore_iter self . logger . info ( "Restoring from {}" . format ( checkpoint ) ) self . generate_sess ( ) saver . restore ( self . sess , checkpoint ) self . logger . info ( "Restoring model done." )
short_docstring: Restore all variables in graph with the latest version
short_docstring_tokens: Restore all variables in graph with the latest version
comment: """Restore all variables in graph with the latest version"""