parameters: (session, forward_only)
return_statement: return model
docstring: Create translation model and initialize or load parameters in session.
docstring_summary: Create translation model and initialize or load parameters in session.
docstring_tokens: Create translation model and initialize or load parameters in session .
function: def create_model(session, forward_only):
    """Create translation model and initialize or load parameters in session."""
    model = seq2seq_model.Seq2SeqModel(
        FLAGS.en_vocab_size, FLAGS.fr_vocab_size, _buckets,
        FLAGS.size, FLAGS.num_layers, FLAGS.max_gradient_norm, FLAGS.batch_size,
        FLAGS.learning_rate, FLAGS.learning_rate_decay_factor,
        forward_only=forward_only)
    ckpt = tf.train.get_checkpoint_state(FLAGS.train_dir)
    if ckpt and tf.gfile.Exists(ckpt.model_checkpoint_path):
      print("Reading model parameters from %s" % ckpt.model_checkpoint_path)
      model.saver.restore(session, ckpt.model_checkpoint_path)
    else:
      print("Created model with fresh parameters.")
      session.run(tf.initialize_all_variables())
    return model
function_tokens: def create_model ( session , forward_only ) : model = seq2seq_model . Seq2SeqModel ( FLAGS . en_vocab_size , FLAGS . fr_vocab_size , _buckets , FLAGS . size , FLAGS . num_layers , FLAGS . max_gradient_norm , FLAGS . batch_size , FLAGS . learning_rate , FLAGS . learning_rate_decay_factor , forward_only = forward_only ) ckpt = tf . train . get_checkpoint_state ( FLAGS . train_dir ) if ckpt and tf . gfile . Exists ( ckpt . model_checkpoint_path ) : print ( "Reading model parameters from %s" % ckpt . model_checkpoint_path ) model . saver . restore ( session , ckpt . model_checkpoint_path ) else : print ( "Created model with fresh parameters." ) session . run ( tf . initialize_all_variables ( ) ) return model