parameters: (self, master, init_op=None, saver=None,
                        checkpoint_dir=None, wait_for_checkpoint=False,
                        max_wait_secs=7200, config=None, init_feed_dict=None,
                        init_fn=None)
return_statement: return sess
docstring: Creates a `Session`. Makes sure the model is ready to be used.
  
      Creates a `Session` on 'master'. If a `saver` object is passed in, and
      `checkpoint_dir` points to a directory containing valid checkpoint
      files, then it will try to recover the model from checkpoint. If
      no checkpoint files are available, and `wait_for_checkpoint` is
      `True`, then the process would check every `recovery_wait_secs`,
      up to `max_wait_secs`, for recovery to succeed.
  
      If the model cannot be recovered successfully then it is initialized by
      either running the provided `init_op`, or calling the provided `init_fn`.
      It is an error if the model cannot be recovered and neither an `init_op`
      or an `init_fn` are passed.
  
      This is a convenient function for the following, with a few error checks
      added:
  
      ```python
      sess, initialized = self.recover_session(master)
      if not initialized:
        if init_op:
          sess.run(init_op, feed_dict=init_feed_dict)
        if init_fn;
          init_fn(sess)
      return sess
      ```
  
      Args:
        master: `String` representation of the TensorFlow master to use.
        init_op: Optional `Operation` used to initialize the model.
        saver: A `Saver` object used to restore a model.
        checkpoint_dir: Path to the checkpoint files.
        wait_for_checkpoint: Whether to wait for checkpoint to become available.
        max_wait_secs: Maximum time to wait for checkpoints to become available.
        config: Optional `ConfigProto` proto used to configure the session.
        init_feed_dict: Optional dictionary that maps `Tensor` objects to feed
          values.  This feed dictionary is passed to the session `run()` call when
          running the init op.
        init_fn: Optional callable used to initialize the model. Called after the
          optional `init_op` is called.  The callable must accept one argument,
          the session being initialized.
  
      Returns:
        A `Session` object that can be used to drive the model.
  
      Raises:
        RuntimeError: If the model cannot be initialized or recovered.
docstring_summary: Creates a `Session`. Makes sure the model is ready to be used.
docstring_tokens: Creates a Session . Makes sure the model is ready to be used .
function: def prepare_session(self, master, init_op=None, saver=None,
                        checkpoint_dir=None, wait_for_checkpoint=False,
                        max_wait_secs=7200, config=None, init_feed_dict=None,
                        init_fn=None):
      """Creates a `Session`. Makes sure the model is ready to be used.
  
      Creates a `Session` on 'master'. If a `saver` object is passed in, and
      `checkpoint_dir` points to a directory containing valid checkpoint
      files, then it will try to recover the model from checkpoint. If
      no checkpoint files are available, and `wait_for_checkpoint` is
      `True`, then the process would check every `recovery_wait_secs`,
      up to `max_wait_secs`, for recovery to succeed.
  
      If the model cannot be recovered successfully then it is initialized by
      either running the provided `init_op`, or calling the provided `init_fn`.
      It is an error if the model cannot be recovered and neither an `init_op`
      or an `init_fn` are passed.
  
      This is a convenient function for the following, with a few error checks
      added:
  
      ```python
      sess, initialized = self.recover_session(master)
      if not initialized:
        if init_op:
          sess.run(init_op, feed_dict=init_feed_dict)
        if init_fn;
          init_fn(sess)
      return sess
      ```
  
      Args:
        master: `String` representation of the TensorFlow master to use.
        init_op: Optional `Operation` used to initialize the model.
        saver: A `Saver` object used to restore a model.
        checkpoint_dir: Path to the checkpoint files.
        wait_for_checkpoint: Whether to wait for checkpoint to become available.
        max_wait_secs: Maximum time to wait for checkpoints to become available.
        config: Optional `ConfigProto` proto used to configure the session.
        init_feed_dict: Optional dictionary that maps `Tensor` objects to feed
          values.  This feed dictionary is passed to the session `run()` call when
          running the init op.
        init_fn: Optional callable used to initialize the model. Called after the
          optional `init_op` is called.  The callable must accept one argument,
          the session being initialized.
  
      Returns:
        A `Session` object that can be used to drive the model.
  
      Raises:
        RuntimeError: If the model cannot be initialized or recovered.
      """
      sess, initialized = self.recover_session(
          master, saver, checkpoint_dir=checkpoint_dir,
          wait_for_checkpoint=wait_for_checkpoint,
          max_wait_secs=max_wait_secs, config=config)
      if not initialized:
        if not init_op and not init_fn:
          raise RuntimeError("Model is not initialized and no init_op or "
                             "init_fn was given")
        if init_op:
          sess.run(init_op, feed_dict=init_feed_dict)
        if init_fn:
          init_fn(sess)
        not_ready = self._model_not_ready(sess)
        if not_ready:
          raise RuntimeError("Init operations did not make model ready.  "
                             "Init op: %s, init fn: %s, error: %s"
                             % (init_op.name, init_fn, not_ready))
      return sess
function_tokens: def prepare_session ( self , master , init_op = None , saver = None , checkpoint_dir = None , wait_for_checkpoint = False , max_wait_secs = 7200 , config = None , init_feed_dict = None , init_fn = None ) : sess , initialized = self . recover_session ( master , saver , checkpoint_dir = checkpoint_dir , wait_for_checkpoint = wait_for_checkpoint , max_wait_secs = max_wait_secs , config = config ) if not initialized : if not init_op and not init_fn : raise RuntimeError ( "Model is not initialized and no init_op or " "init_fn was given" ) if init_op : sess . run ( init_op , feed_dict = init_feed_dict ) if init_fn : init_fn ( sess ) not_ready = self . _model_not_ready ( sess ) if not_ready : raise RuntimeError ( "Init operations did not make model ready.  " "Init op: %s, init fn: %s, error: %s" % ( init_op . name , init_fn , not_ready ) ) return sess