brainpy.losses module#

This module implements several loss functions.

cross_entropy_loss(logits, targets[, ...])

This criterion combines LogSoftmax and NLLLoss` in one single class.

l1_loos(logits, targets[, reduction])

Creates a criterion that measures the mean absolute error (MAE) between each element in the logits \(x\) and targets \(y\).

l2_loss(predicts, targets)

Computes the L2 loss.

l2_norm(x)

Computes the L2 loss.

huber_loss(predicts, targets[, delta])

Huber loss.

mean_absolute_error(x, y[, axis])

Computes the mean absolute error between x and y.

mean_squared_error(predicts, targets[, axis])

Computes the mean squared error between x and y.

mean_squared_log_error(y_true, y_pred[, axis])

Computes the mean squared logarithmic error between y_true and y_pred.