lm1b/model/model_nodes.py
def attach_predicted_word_nodes(logits, id_to_word_lookup_table, k=5, hparams=None):
  """
  Helper to pull out the most likely words
  :param logits:
  :param id_to_word_lookup_table:
  :param k:
  :param hparams:
  :return:
  """
  top_k = tf.nn.top_k(logits, k)
  top_word_ids = top_k.indices
  word_predictions = tf.reshape(id_to_word_lookup_table.lookup(tf.to_int64(tf.reshape(top_word_ids, [-1]))), [-1, k])
  return {"predicted_words": word_predictions,
          "top_k": top_k}

  Helper to pull out the most likely words
  :param logits:
  :param id_to_word_lookup_table:
  :param k:
  :param hparams:
  :return:
  
Helper to pull out the most likely words
Helper to pull out the most likely words
def attach_predicted_word_nodes(logits, id_to_word_lookup_table, k=5, hparams=None):
  top_k = tf.nn.top_k(logits, k)
  top_word_ids = top_k.indices
  word_predictions = tf.reshape(id_to_word_lookup_table.lookup(tf.to_int64(tf.reshape(top_word_ids, [-1]))), [-1, k])
  return {"predicted_words": word_predictions,
          "top_k": top_k}
def attach_predicted_word_nodes ( logits , id_to_word_lookup_table , k = 5 , hparams = None ) : top_k = tf . nn . top_k ( logits , k ) top_word_ids = top_k . indices word_predictions = tf . reshape ( id_to_word_lookup_table . lookup ( tf . to_int64 ( tf . reshape ( top_word_ids , [ - 1 ] ) ) ) , [ - 1 , k ] ) return { "predicted_words" : word_predictions , "top_k" : top_k }
Helper to pull out the most likely words
Helper to pull out the most likely words
"""
  Helper to pull out the most likely words
  :param logits:
  :param id_to_word_lookup_table:
  :param k:
  :param hparams:
  :return:
  """
None
logits
None
id_to_word_lookup_table
None
k
None
hparams
None