View source on GitHub
|
Performs beam search decoding on the logits given in input.
tf.compat.v1.nn.ctc_beam_search_decoder(
inputs, sequence_length, beam_width=100, top_paths=1, merge_repeated=True
)
ctc_beam_search_decodertreats blanks as sequence terminationctc_greedy_decodertreats blanks as regular elements
If merge_repeated is True, merge repeated classes in the output beams.
This means that if consecutive entries in a beam are the same,
only the first of these is emitted. That is, when the sequence is
A B B * B * B (where '*' is the blank label), the return value is:
A Bifmerge_repeated = True.A B B Bifmerge_repeated = False.
Args |
|---|
inputs
float Tensor, size [max_time x batch_size x num_classes].
The logits.
sequence_length
int32 vector containing sequence lengths, having size
[batch_size].
beam_width
top_paths
merge_repeated
Returns | |
|---|---|
A tuple (decoded, log_probabilities) where
|
|
decoded
|
A list of length top_paths, where decoded[j]
is a SparseTensor containing the decoded outputs: |
decoded[j].indices: Indices matrix (total_decoded_outputs[j] x 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]].
log_probability
float matrix (batch_size x top_paths) containing
sequence log-probabilities.
View source on GitHub