original_docstring: 
      Saves a snapshot of the current session, saving all variables previously defined
      in the ctor of the saver. Also saves the flow of the graph itself (only once).
      
docstring: Saves a snapshot of the current session, saving all variables previously defined
  in the ctor of the saver. Also saves the flow of the graph itself (only once).
docstring_tokens: Saves a snapshot of the current session saving all variables previously defined in the ctor of the saver . Also saves the flow of the graph itself ( only once ) .
code: def save_snapshot(sess, saver, save_dir, snapshot_prefix, epoch, for_serving=False):
      """
      Saves a snapshot of the current session, saving all variables previously defined
      in the ctor of the saver. Also saves the flow of the graph itself (only once).
      """
      number_dec = str(FLAGS.snapshotInterval-int(FLAGS.snapshotInterval))[2:]
      if number_dec is '':
          number_dec = '0'
      epoch_fmt = "{:." + number_dec + "f}"
  
      snapshot_file = os.path.join(save_dir, snapshot_prefix + '_' + epoch_fmt.format(epoch) + '.ckpt')
  
      logging.info('Snapshotting to %s', snapshot_file)
      checkpoint_path = saver.save(sess, snapshot_file)
      logging.info('Snapshot saved.')
  
      if for_serving:
          # @TODO(tzaman) : we could further extend this by supporting tensorflow-serve
          logging.error('NotImplementedError: Tensorflow-Serving support.')
          exit(-1)
  
      # Past this point the graph shouldn't be changed, so saving it once is enough
      filename_graph = os.path.join(save_dir, snapshot_prefix + '.graph_def')
      if not os.path.isfile(filename_graph):
          with open(filename_graph, 'wb') as f:
              logging.info('Saving graph to %s', filename_graph)
              f.write(sess.graph_def.SerializeToString())
              logging.info('Saved graph to %s', filename_graph)
          # meta_graph_def = tf.train.export_meta_graph(filename='?')
  
      return checkpoint_path, filename_graph
code_tokens: def save_snapshot ( sess , saver , save_dir , snapshot_prefix , epoch , for_serving = False ) : number_dec = str ( FLAGS . snapshotInterval - int ( FLAGS . snapshotInterval ) ) [ 2 : ] if number_dec is '' : number_dec = '0' epoch_fmt = "{:." + number_dec + "f}" snapshot_file = os . path . join ( save_dir , snapshot_prefix + '_' + epoch_fmt . format ( epoch ) + '.ckpt' ) logging . info ( 'Snapshotting to %s' , snapshot_file ) checkpoint_path = saver . save ( sess , snapshot_file ) logging . info ( 'Snapshot saved.' ) if for_serving : logging . error ( 'NotImplementedError: Tensorflow-Serving support.' ) exit ( - 1 ) filename_graph = os . path . join ( save_dir , snapshot_prefix + '.graph_def' ) if not os . path . isfile ( filename_graph ) : with open ( filename_graph , 'wb' ) as f : logging . info ( 'Saving graph to %s' , filename_graph ) f . write ( sess . graph_def . SerializeToString ( ) ) logging . info ( 'Saved graph to %s' , filename_graph ) return checkpoint_path , filename_graph
short_docstring: Saves a snapshot of the current session, saving all variables previously defined
  in the ctor of the saver.
short_docstring_tokens: Saves a snapshot of the current session saving all variables previously defined in the ctor of the saver .
comment: """
      Saves a snapshot of the current session, saving all variables previously defined
      in the ctor of the saver. Also saves the flow of the graph itself (only once).
      """$SEP$# @TODO(tzaman) : we could further extend this by supporting tensorflow-serve$SEP$# Past this point the graph shouldn't be changed, so saving it once is enough$SEP$# meta_graph_def = tf.train.export_meta_graph(filename='?')