LossFunctionBase<T>
Base Classes · AiDotNet.LossFunctions
Base class for loss function implementations.
Implements: ILossFunction<T>
Known derived types: ABINetMultiTaskLoss<T>, APNet2GeneratorLoss<T>, AdversarialLoss<T>, BinaryCrossEntropyLoss<T>, BinaryCrossEntropyWithLogitsLoss<T>, BornRuleMseLoss<T>, CIoULoss<T>, CTCLoss<T>, CategoricalCrossEntropyLoss<T>, CharbonnierLoss<T>, CompositeLossWithLogits<T>, CompositeLoss<T>, ContrastiveLoss<T>, CosineSimilarityLoss<T>, CrossEntropyLoss<T>, CrossEntropyWithLogitsLoss<T>, DETRSetLoss<T>, DIoULoss<T>, DiceLoss<T>, DistillationLossAdapter<T>, ElasticNetLoss<T>, ExponentialLoss<T>, FactorVAEObjective<T>, FlowLoss<T>, FocalLoss<T>, GIoULoss<T>, HingeLoss<T>, HuberLoss<T>, JaccardLoss<T>, KullbackLeiblerDivergence<T>, LogCoshLoss<T>, MarginLoss<T>, MaskedRowLoss<T>, MeanAbsoluteErrorLoss<T>, MeanBiasErrorLoss<T>, MeanSquaredErrorLoss<T>, ModifiedHuberLoss<T>, MultiResolutionStftLoss<T>, NegativeSiSnrLoss<T>, NoiseContrastiveEstimationLoss<T>, OrdinalRegressionLoss<T>, PSENetLoss<T>, PSNRLoss<T>, PairwiseRankingLoss<T>, ParaformerObjective<T>, PerceptualLoss<T>, PhysicsInformedLoss<T>, PoissonLoss<T>, QuantileLoss<T>, QuantumLoss<T>, RealESRGANLoss<T>, RootMeanSquaredErrorLoss<T>, RotationPredictionLoss<T>, ScaleInvariantDepthLoss<T>, SparseCategoricalCrossEntropyLoss<T>, SquaredHingeLoss<T>, TripletLoss<T>, WassersteinLoss<T>, WeightedCrossEntropyLoss<T>
Methods
| Method | Summary |
|---|---|
T CalculateLoss(Vector<T> predicted, Vector<T> actual) |
Calculates the loss between predicted and actual values. |
Tensor<T> ComputeTapeLoss(Tensor<T> predicted, Tensor<T> target) |
Computes the loss as a scalar tensor using tape-differentiable engine operations. |
ValueTuple<T, Tensor<T>> CalculateLossAndGradientGpu(Tensor<T> predicted, Tensor<T> actual) |
Calculates both loss and gradient on GPU in a single pass. |