l2_loss

Contents

l2_loss#

class brainpy.losses.l2_loss(predicts, targets)[source]#

Computes the L2 loss.

The 0.5 term is standard in “Pattern Recognition and Machine Learning” by Bishop [1], but not “The Elements of Statistical Learning” by Tibshirani.

Parameters:
  • predicts (ArrayType) – A vector of arbitrary shape.

  • targets (ArrayType) – A vector of shape compatible with predictions.

Returns:

loss – A scalar value containing the l2 loss.

Return type:

float

References