c8523b2dc735a1b82ca6170e6ca349defe9f77fc,examples/transformer.py,,,#,22
Before Change
encoder_output = encoder(src_text["text_ids"][:, :-1],
sequence_length=src_text["length"]-1)
// Decode
outputs, final_state, sequence_lengths = decoder(
initial_state=connector(text_database._hparams.batch_size))
// Build loss
mle_loss = mle_losses.average_sequence_sparse_softmax_cross_entropy(
labels=tgt_text["text_ids"][:, 1:],
After Change
sequence_length=text_data_batch["source_length"])
// Decode
print("encoder_output:{}".format(encoder_output.shape))
logits, preds = decoder(decoder_inputs, encoder_output)
print("logits:{}".format(logits.shape))
//istarget = tf.to_float(tf.not_equal(y, 0))
// acc = tf.reduce_sum(tf.to_float(tf.equal(preds,
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 4
Instances
Project Name: asyml/texar
Commit Name: c8523b2dc735a1b82ca6170e6ca349defe9f77fc
Time: 2017-11-17
Author: shore@pku.edu.cn
File Name: examples/transformer.py
Class Name:
Method Name:
Project Name: OpenNMT/OpenNMT-py
Commit Name: 522104535e9b0ab4ca4ea8213f4034e1802412f4
Time: 2018-11-02
Author: vince62s@yahoo.com
File Name: onmt/models/model.py
Class Name: NMTModel
Method Name: forward
Project Name: pytorch/examples
Commit Name: 632d385444ae16afe3e4003c94864f9f97dc8541
Time: 2019-09-04
Author: hongyu@mail.com
File Name: word_language_model/model.py
Class Name: RNNModel
Method Name: forward