tensorflow / nmt

TensorFlow Neural Machine Translation Tutorial
Apache License 2.0
6.37k stars 1.96k forks source link

How should `source_sequence_length` and `decoder_lengths` be passed in? #187

Closed ghost closed 6 years ago

oahziur commented 6 years ago

@nave01314 The source_sequence_length and decoder_lengths for training are calculated before we pad the source sequence and the target sequence. You can checkout the code here for getting the sequence length.

It is very common to pad sequential data, so dynamic_rnn can evaluate the full batch until the max sequence length in the batch. Note that the inputs to dynamic_rnn has to be a tensor with shape [batch_size, max_time, ...].

fooSynaptic commented 5 years ago

@oahziur i still cannot control the length of decode sequence even i set the tgt_max_len. I spend lots of time to find the wrappers about this parameter, can you help me ?

image