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  

Constants

String OP_NAME The name of this op, as known by TensorFlow core engine

Public Methods

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

Inherited Methods

Constants

public static final String OP_NAME

The name of this op, as known by TensorFlow core engine

Constant Value: "CTCLossV2"

Public Methods

public static CTCLossV2 create (Scope scope, Operand<TFloat32> inputs, Operand<TInt64> labelsIndices, Operand<TInt32> labelsValues, Operand<TInt32> 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<TFloat32> 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<TFloat32> 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.