graykode / nlp-tutorial

Natural Language Processing Tutorial for Deep Learning Researchers
https://www.reddit.com/r/MachineLearning/comments/amfinl/project_nlptutoral_repository_who_is_studying/
MIT License
14.31k stars 3.95k forks source link

A question about Autocomplete LSTM Tensorflow #25

Closed nvlong198 closed 5 years ago

nvlong198 commented 5 years ago

In Autocomplete We already have

X = tf.placeholder(tf.float32, [None, n_step, n_class]) # [batch_size, n_step, n_class]
Y = tf.placeholder(tf.float32, [None, n_class])         

to guess next missing character

  1. How I can customize them to guess more than 1 character ? I don't have any idea about multiplies a tensor by tensor.
  2. In outputs, states = tf.nn.dynamic_rnn(cell, X, dtype=tf.float32) Why the shape of states alway (2,), what really 2 mean ? Thank you for sharing the information. aTDpS
graykode commented 5 years ago

Hello. Sorry for late.

  1. Its simple. you just sort output logits then pick k which number you want.
  2. Please see tensorflow document https://www.tensorflow.org/api_docs/python/tf/nn/dynamic_rnn