MeanAbsoluteError

class dragon.vm.tensorflow.keras.losses.MeanAbsoluteError(
  reduction='mean',
  name=None
)[source]

A criterion to compute the reduced element-wise absolute value difference.

The AbsoluteError function is defined as:

\[\text{AbsoluteError}(y_{true}, y_{pred}) = |y_{pred} - y_{true}| \]

Examples:

criterion = tf.keras.losses.MeanAbsoluteError()
y_true = tf.constant([1., 2., 3.])
y_pred = tf.constant([0., 0., 0.])
print(criterion(y_true, y_pred))  # 2.0

__init__

MeanAbsoluteError.__init__(
  reduction='mean',
  name=None
)[source]

Create a MeanAbsoluteError criterion.

Parameters:
  • reduction ({'none', 'sum', 'mean'}, optional) – The reduction method.
  • name (str, optional) – The operation name.

Methods

__call__

Loss.__call__(
  y_true,
  y_pred
)[source]

Compute the defined loss function.

Parameters:
Returns:

dragon.Tensor – The loss.