tf.raw_ops.CTCLossV2
Calculates the CTC Loss (log probability) for each batch entry. Also calculates
tf.raw_ops.CTCLossV2( inputs, labels_indices, labels_values, sequence_length, preprocess_collapse_repeated=False, ctc_merge_repeated=True, ignore_longer_outputs_than_inputs=False, name=None )
the gradient. This class performs the softmax operation for you, so inputs should be e.g. linear projections of outputs by an LSTM.
Args | |
---|---|
inputs | A Tensor of type float32 . 3-D, shape: (max_time x batch_size x num_classes) , the logits. Default blank label is 0 rather num_classes - 1. |
labels_indices | A Tensor of type int64 . The indices of a SparseTensor<int32, 2> . labels_indices(i, :) == [b, t] means labels_values(i) stores the id for (batch b, time t) . |
labels_values | A Tensor of type int32 . The values (labels) associated with the given batch and time. |
sequence_length | A Tensor of type int32 . A vector containing sequence lengths (batch). |
preprocess_collapse_repeated | An optional bool . Defaults to False . Scalar, if true then repeated labels are collapsed prior to the CTC calculation. |
ctc_merge_repeated | An optional bool . Defaults to True . Scalar. If set to false, during CTC calculation repeated non-blank labels will not be merged and are interpreted as individual labels. This is a simplified version of CTC. |
ignore_longer_outputs_than_inputs | An optional bool . Defaults to False . Scalar. If set to true, during CTC calculation, items that have longer output sequences than input sequences are skipped: they don't contribute to the loss term and have zero-gradient. |
name | A name for the operation (optional). |
Returns | |
---|---|
A tuple of Tensor objects (loss, gradient). | |
loss | A Tensor of type float32 . |
gradient | A Tensor of type float32 . |
© 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/r2.4/api_docs/python/tf/raw_ops/CTCLossV2