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.cost.MeanAbsoluteError() y_true = tf.constant([1., 2., 3.]) y_pred = tf.constant([0., 0., 0.]) print(criterion(y_true, y_pred)) # 2.0
__init__¶
Methods¶
__call__¶
Loss.
__call__
(
y_true,
y_pred
)[source]Compute the defined loss function.
- Parameters:
- y_true (dragon.Tensor) – The ground-truth tensor.
- y_pred (dragon.Tensor) – The logits tensor.
- Returns:
dragon.Tensor – The loss.