Nodes of different colours represent the following:
Solid arrows point from a submodule to the (sub)module which it is
descended from. Dashed arrows point from a module or program unit to
modules which it uses.
Where possible, edges connecting nodes are
given different colours to make them easier to distinguish in
large graphs.
Nodes of different colours represent the following:
Solid arrows point from a submodule to the (sub)module which it is
descended from. Dashed arrows point from a module or program unit to
modules which it uses.
Where possible, edges connecting nodes are
given different colours to make them easier to distinguish in
large graphs.
Nodes of different colours represent the following:
Solid arrows point from a derived type to the parent type which it
extends. Dashed arrows point from a derived type to the other
types it contains as a components, with a label listing the name(s) of
said component(s).
Where possible, edges connecting nodes are
given different colours to make them easier to distinguish in
large graphs.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Where possible, edges connecting nodes are
given different colours to make them easier to distinguish in
large graphs.
Computes the sum of absolute differences between predictions and
reference values: ∑|pred_i - ref_i|. This is the unnormalized
form that will be normalized later by the collect function.
self - The MAE loss function instance
batchsize - Number of samples in the batch
prediction - Predicted values for the batch
reference - Reference (target) values for the batch
Returns: Sum of absolute errors (unnormalized)
Arguments
self :
class(LossMAE) [in]– The MAE loss function instance
batchsize :
integer [in]– Number of samples in batch
Normalize the sum of absolute errors to get the final MAE value.
Converts the sum of absolute errors into the final MAE by dividing
by the total number of samples. This function handles the final
normalization step for both local and MPI-collected computations.
global_sum_loss - Sum of absolute errors across all processes
global_batchsize - Total number of samples across all processes
Returns: Final normalized MAE value
Arguments
global_sum_loss :
real(DP) [in]– Sum of absolute errors
global_batchsize :
integer [in]– Total number of samples
Calculate the gradient of MAE with respect to predictions.
Computes the derivative of the MAE loss function:
[ \frac{\partial \text{MAE}}{\partial \hat{y}_i} = \frac{1}{n} \text{sign}(\hat{y}_i - y_i) ]
The derivative is the sign of the prediction error, normalized by
the batch size. Note that the derivative is undefined at zero error,
but the sign function handles this by returning a valid gradient.
self - The MAE loss function instance
batchsize - Number of samples in the batch
prediction - Predicted values for the batch
reference - Reference (target) values for the batch
Returns: Gradient vector with respect to each prediction
Arguments
self :
class(LossMAE) [in]– The MAE loss function instance
batchsize :
integer [in]– Number of samples in batch