Skip to content

Commit

Permalink
polish examples/seq2seq_attn code
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhitingHu committed Oct 9, 2018
1 parent d223165 commit 5a57b6b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions examples/seq2seq_attn/seq2seq_attn.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ def build_model(batch, train_data):
inputs=target_embedder(batch['target_text_ids'][:, :-1]),
sequence_length=batch['target_length'] - 1)

train_op = tx.core.get_train_op(
tx.losses.sequence_sparse_softmax_cross_entropy(
labels=batch['target_text_ids'][:, 1:],
logits=training_outputs.logits,
sequence_length=batch['target_length'] - 1),
hparams=config_model.opt)
mle_loss = tx.losses.sequence_sparse_softmax_cross_entropy(
labels=batch['target_text_ids'][:, 1:],
logits=training_outputs.logits,
sequence_length=batch['target_length'] - 1)

train_op = tx.core.get_train_op(mle_loss, hparams=config_model.opt)

start_tokens = tf.ones_like(batch['target_length']) * \
train_data.target_vocab.bos_token_id
Expand Down

0 comments on commit 5a57b6b

Please sign in to comment.