Skip to content
This repository has been archived by the owner on Jan 1, 2021. It is now read-only.

Fix one-hot encoding #80

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/11_char_rnn_gist.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def create_rnn(seq, hidden_size=HIDDEN_SIZE):
return output, in_state, out_state

def create_model(seq, temp, vocab, hidden=HIDDEN_SIZE):
seq = tf.one_hot(seq, len(vocab))
seq = tf.one_hot(seq - 1, len(vocab))
output, in_state, out_state = create_rnn(seq, hidden)
# fully_connected is syntactic sugar for tf.matmul(w, output) + b
# it will create w and b for us
Expand Down Expand Up @@ -103,7 +103,7 @@ def online_inference(sess, vocab, seq, sample, temp, in_state, out_state, seed='
if state is not None:
feed.update({in_state: state})
index, state = sess.run([sample, out_state], feed)
sentence += vocab_decode(index, vocab)
sentence += vocab_decode(index + 1, vocab)
print(sentence)

def main():
Expand All @@ -120,4 +120,4 @@ def main():
training(vocab, seq, loss, optimizer, global_step, temp, sample, in_state, out_state)

if __name__ == '__main__':
main()
main()