CtcLoss

public final class CtcLoss

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 CtcLoss.Options Optional attributes for CtcLoss  

Constants

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

Public Methods

static <T extends TNumber> CtcLoss<T>
create(Scope scope, Operand<T> inputs, Operand<TInt64> labelsIndices, Operand<TInt32> labelsValues, Operand<TInt32> sequenceLength, Options... options)
Factory method to create a class wrapping a new CtcLoss operation.
static CtcLoss.Options
ctcMergeRepeated(Boolean ctcMergeRepeated)
Output<T>
gradient()
The gradient of `loss`.
static CtcLoss.Options
ignoreLongerOutputsThanInputs(Boolean ignoreLongerOutputsThanInputs)
Output<T>
loss()
A vector (batch) containing log-probabilities.
static CtcLoss.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: "CTCLoss"

Public Methods

public static CtcLoss<T> create (Scope scope, Operand<T> inputs, Operand<TInt64> labelsIndices, Operand<TInt32> labelsValues, Operand<TInt32> sequenceLength, Options... options)

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

Parameters
scope current scope
inputs 3-D, shape: `(max_time x batch_size x num_classes)`, the logits.
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 CtcLoss

public static CtcLoss.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<T> gradient ()

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

public static CtcLoss.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<T> loss ()

A vector (batch) containing log-probabilities.

public static CtcLoss.Options preprocessCollapseRepeated (Boolean preprocessCollapseRepeated)

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