SiaNet/Losses/CategoricalCrossentropy.cs
/// <summary>
/// Backpropagation method to calculate gradient of the loss function
/// </summary>
/// <param name="preds">The predicted result.</param>
/// <param name="labels">The true result.</param>
/// <returns></returns>
Backpropagation method to calculate gradient of the loss function
Backpropagation method to calculate gradient of the loss function
public override Tensor Backward(Tensor preds, Tensor labels)
        {
            preds = K.Clip(preds, K.Epsilon(), 1 - K.Epsilon());
            return (preds - labels) / preds;
        }
public override Tensor Backward ( Tensor preds , Tensor labels ) { preds = K . Clip ( preds , K . Epsilon ( ) , 1 - K . Epsilon ( ) ) ; return ( preds - labels ) / preds ; }
Backpropagation method to calculate gradient of the loss function
Backpropagation method to calculate gradient of the loss function
None
preds
Tensor
The predicted result.
The predicted result .
labels
Tensor
The true result.
The true result .