Skip to content

Commit

Permalink
add seq2seq model; add seq2seq test
Browse files Browse the repository at this point in the history
  • Loading branch information
Lingjun Liu authored and Lingjun Liu committed May 25, 2019
1 parent 8989efc commit 6401d54
Show file tree
Hide file tree
Showing 5 changed files with 10,033 additions and 20 deletions.
3 changes: 3 additions & 0 deletions examples/text_generation/tutorial_generate_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,12 @@ def main_lstm_generate_text():
# reset all states at the begining of every epoch
lstm_state = None
for step, (x, y) in enumerate(tl.iterate.ptb_iterator(train_data, batch_size, sequence_length)):
print(">>>>>", y)
with tf.GradientTape() as tape:

## compute outputs
logits, lstm_state = net(x, initial_state=lstm_state)
print(">>>>logits" , logits)
## compute loss and update model
cost = tl.cost.cross_entropy(logits, tf.reshape(y, [-1]), name='train_loss')

Expand Down
Loading

0 comments on commit 6401d54

Please sign in to comment.