[null,null,["Last updated 2024-04-26 UTC."],[],[],null,["# tf.nn.ctc_beam_search_decoder\n\n\u003cbr /\u003e\n\n|---------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.16.1/tensorflow/python/ops/ctc_ops.py#L446-L495) |\n\nPerforms beam search decoding on the logits given in input.\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.nn.ctc_beam_search_decoder_v2`](https://www.tensorflow.org/api_docs/python/tf/nn/ctc_beam_search_decoder)\n\n\u003cbr /\u003e\n\n tf.nn.ctc_beam_search_decoder(\n inputs, sequence_length, beam_width=100, top_paths=1\n )\n\n| **Note:** Although in general greedy search is a special case of beam-search with `top_paths=1` and `beam_width=1`, `ctc_beam_search_decoder` differs from `ctc_greedy_decoder` in the treatment of blanks when computing the probability of a sequence:\n\n- `ctc_beam_search_decoder` treats blanks as sequence termination\n- `ctc_greedy_decoder` treats blanks as regular elements\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|-------------------|-------------------------------------------------------------------------------|\n| `inputs` | 3-D `float` `Tensor`, size `[max_time, batch_size, num_classes]`. The logits. |\n| `sequence_length` | 1-D `int32` vector containing sequence lengths, having size `[batch_size]`. |\n| `beam_width` | An int scalar \\\u003e= 0 (beam search beam width). |\n| `top_paths` | An int scalar \\\u003e= 0, \\\u003c= beam_width (controls output size). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|-------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| A tuple `(decoded, log_probabilities)` where ||\n| `decoded` | A list of length top_paths, where `decoded[j]` is a `SparseTensor` containing the decoded outputs: \u003cbr /\u003e `decoded[j].indices`: Indices matrix `[total_decoded_outputs[j], 2]`; The rows store: `[batch, time]`. `decoded[j].values`: Values vector, size `[total_decoded_outputs[j]]`. The vector stores the decoded classes for beam `j`. `decoded[j].dense_shape`: Shape vector, size `(2)`. The shape values are: `[batch_size, max_decoded_length[j]]`. |\n| `log_probability` | A `float` matrix `[batch_size, top_paths]` containing sequence log-probabilities. |\n\n\u003cbr /\u003e"]]