mean_absolute_error

dragon.vm.tensorflow.keras.losses.mean_absolute_error(
  y_true,
  y_pred,
  reduction='mean'
)[source]

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:

y_true = tf.constant([1., 2., 3.])
y_pred = tf.constant([0., 0., 0.])
print(tf.keras.losses.mean_absolute_error(y_true, y_pred))  # 2.0
Parameters:
  • y_true (dragon.Tensor) – The ground truth tensor.
  • y_pred (dragon.Tensor) – The logits tensor.
  • reduction ({'none', 'sum', 'mean'}, optional) – The reduction method.