CTCLossV2

public final class CTCLossV2

Calculates the CTC Loss (log probability) for each batch entry. Also calculates

the gradient. This class performs the softmax operation for you, so inputs should be e.g. linear projections of outputs by an LSTM.

Nested Classes

class CTCLossV2.Options Optional attributes for CTCLossV2  

Public Methods

static CTCLossV2
create(Scope scope, Operand<Float> inputs, Operand<Long> labelsIndices, Operand<Integer> labelsValues, Operand<Integer> sequenceLength, Options... options)
Factory method to create a class wrapping a new CTCLossV2 operation.
static CTCLossV2.Options
ctcMergeRepeated(Boolean ctcMergeRepeated)
Output<Float>
gradient()
The gradient of `loss`.
static CTCLossV2.Options
ignoreLongerOutputsThanInputs(Boolean ignoreLongerOutputsThanInputs)
Output<Float>
loss()
A vector (batch) containing log-probabilities.
static CTCLossV2.Options
preprocessCollapseRepeated(Boolean preprocessCollapseRepeated)

Inherited Methods

Public Methods

public static CTCLossV2 create (Scope scope, Operand<Float> inputs, Operand<Long> labelsIndices, Operand<Integer> labelsValues, Operand<Integer> sequenceLength, Options... options)

Factory method to create a class wrapping a new CTCLossV2 operation.

Parameters
scope current scope
inputs 3-D, shape: `(max_time x batch_size x num_classes)`, the logits. Default blank label is 0 rather num_classes - 1.
labelsIndices The indices of a `SparseTensor`. `labels_indices(i, :) == [b, t]` means `labels_values(i)` stores the id for `(batch b, time t)`.
labelsValues The values (labels) associated with the given batch and time.
sequenceLength A vector containing sequence lengths (batch).
options carries optional attributes values
Returns
  • a new instance of CTCLossV2

public static CTCLossV2.Options ctcMergeRepeated (Boolean ctcMergeRepeated)

Parameters
ctcMergeRepeated 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.

public Output<Float> gradient ()

The gradient of `loss`. 3-D, shape: `(max_time x batch_size x num_classes)`.

public static CTCLossV2.Options ignoreLongerOutputsThanInputs (Boolean ignoreLongerOutputsThanInputs)

Parameters
ignoreLongerOutputsThanInputs 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.

public Output<Float> loss ()

A vector (batch) containing log-probabilities.

public static CTCLossV2.Options preprocessCollapseRepeated (Boolean preprocessCollapseRepeated)

Parameters
preprocessCollapseRepeated Scalar, if true then repeated labels are collapsed prior to the CTC calculation.