Class CTCLossAdapter<T>
- Namespace
- AiDotNet.LossFunctions
- Assembly
- AiDotNet.dll
Provides an adapter for using CTCLoss within the LossFunctionBase framework.
public class CTCLossAdapter<T> : LossFunctionBase<T>, ILossFunction<T>
Type Parameters
TThe numeric type used for calculations.
- Inheritance
-
CTCLossAdapter<T>
- Implements
- Inherited Members
- Extension Methods
Constructors
CTCLossAdapter(int, int)
Initializes a new instance of the CTCLossAdapter class.
public CTCLossAdapter(int numClasses, int blankIndex = 0)
Parameters
Methods
CalculateDerivative(Vector<T>, Vector<T>)
Calculates the derivative of the CTC loss.
public override Vector<T> CalculateDerivative(Vector<T> predicted, Vector<T> actual)
Parameters
predictedVector<T>The predicted log probabilities as a flattened vector.
actualVector<T>The target labels as a flattened vector.
Returns
- Vector<T>
The gradient vector with respect to inputs.
CalculateLoss(Vector<T>, Vector<T>)
Adapts the standard loss interface to work with CTC loss.
public override T CalculateLoss(Vector<T> predicted, Vector<T> actual)
Parameters
predictedVector<T>The predicted log probabilities as a flattened vector.
actualVector<T>The target labels as a flattened vector.
Returns
- T
The CTC loss value.