SiaNet/Losses/MeanSquaredLogError.cs
/// <summary>
/// Forwards the inputs and calculate the loss.
/// </summary>
/// <param name="preds">The predicted result.</param>
/// <param name="labels">The true result.</param>
/// <returns></returns>
Forwards the inputs and calculate the loss.
Forwards the inputs and calculate the loss .
public override Tensor Forward(Tensor preds, Tensor labels)
        {
            var first_log = K.Log(K.Clip(preds, K.Epsilon(), float.MaxValue) + 1);
            var second_log = K.Log(K.Clip(labels, K.Epsilon(), float.MaxValue) + 1);
            return K.Mean(K.Square(first_log - second_log), -1);
        }
public override Tensor Forward ( Tensor preds , Tensor labels ) { var first_log = K . Log ( K . Clip ( preds , K . Epsilon ( ) , float . MaxValue ) + 1 ) ; var second_log = K . Log ( K . Clip ( labels , K . Epsilon ( ) , float . MaxValue ) + 1 ) ; return K . Mean ( K . Square ( first_log - second_log ) , - 1 ) ; }
Forwards the inputs and calculate the loss.
Forwards the inputs and calculate the loss .
None
preds
Tensor
The predicted result.
The predicted result .
labels
Tensor
The true result.
The true result .