| View source on GitHub |
Performs beam search decoding on the logits given in input.
tf.nn.ctc_beam_search_decoder(
inputs, sequence_length, beam_width=100, top_paths=1
)
Note: Although in general greedy search is a special case of beam-search withtop_paths=1andbeam_width=1,ctc_beam_search_decoderdiffers fromctc_greedy_decoderin the treatment of blanks when computing the probability of a sequence:
ctc_beam_search_decoder treats blanks as sequence terminationctc_greedy_decoder treats blanks as regular elements| Args | |
|---|---|
inputs | 3-D float Tensor, size [max_time, batch_size, num_classes]. The logits. |
sequence_length | 1-D int32 vector containing sequence lengths, having size [batch_size]. |
beam_width | An int scalar >= 0 (beam search beam width). |
top_paths | An int scalar >= 0, <= beam_width (controls output size). |
| Returns | |
|---|---|
A tuple (decoded, log_probabilities) where | |
decoded | A list of length top_paths, where decoded[j] is a SparseTensor containing the decoded outputs:
|
log_probability | A float matrix [batch_size, top_paths] containing sequence log-probabilities. |
© 2022 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 4.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.9/api_docs/python/tf/nn/ctc_beam_search_decoder