tf.contrib.seq2seq.gather_tree
Calculates the full beams from the per-step ids and parent beam ids.
tf.contrib.seq2seq.gather_tree( step_ids, parent_ids, max_sequence_lengths, end_token, name=None )
On CPU, if an out of bound parent id is found, an error is returned. On GPU, if an out of bound parent id is found, a -1 is stored in the corresponding output value and the execution for that beam returns early.
For a given beam, past the time step containing the first decoded end_token
all values are filled in with end_token
.
Args | |
---|---|
step_ids | A Tensor . Must be one of the following types: int32 . [max_time, batch_size, beam_width] . |
parent_ids | A Tensor . Must have the same type as step_ids . [max_time, batch_size, beam_width] . |
max_sequence_lengths | A Tensor of type int32 . [batch_size] . |
end_token | A Tensor . Must have the same type as step_ids . [] . |
name | A name for the operation (optional). |
Returns | |
---|---|
A Tensor . Has the same type as step_ids . [max_time, batch_size, beam_width] . |
© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/seq2seq/gather_tree