L1L2#
- class deepinv.loss.metric.L1L2(alpha=0.5, **kwargs)[source]#
- Bases: - Metric- Combined L2 and L1 metric. - Calculates L2 distance (i.e. MSE) + L1 (i.e. MAE) distance, \(\alpha L_1(\hat{x},x)+(1-\alpha)L_2(\hat{x},x)\) where \(\hat{x}=\inverse{y}\). - Note - By default, no reduction is performed in the batch dimension. - Example:
 - >>> import torch >>> from deepinv.loss.metric import L1L2 >>> m = L1L2() >>> x_net = x = torch.ones(3, 2, 8, 8) # B,C,H,W >>> m(x_net, x) tensor([0., 0., 0.]) - Parameters:
- alpha (float) – Weight between L2 and L1. Defaults to 0.5. 
- complex_abs (bool) – perform complex magnitude before passing data to metric function. If - True, the data must either be of complex dtype or have size 2 in the channel dimension (usually the second dimension after batch).
- reduction (str) – a method to reduce metric score over individual batch scores. - mean: takes the mean,- sumtakes the sum,- noneor None no reduction will be applied (default).
- norm_inputs (str) – normalize images before passing to metric. - l2``normalizes by L2 spatial norm, ``min_maxnormalizes by min and max of each input.
 
 
 
    