Formatting

* Adding black as dev dependency
* Formatting pina code
* Formatting tests
This commit is contained in:
Dario Coscia
2025-02-24 11:26:49 +01:00
committed by Nicola Demo
parent 4c4482b155
commit 42ab1a666b
77 changed files with 1170 additions and 924 deletions

View File

@@ -1,10 +1,11 @@
""" Module for LpLoss class """
"""Module for LpLoss class"""
import torch
from ..utils import check_consistency
from .loss_interface import LossInterface
class LpLoss(LossInterface):
r"""
The Lp loss implementation class. Creates a criterion that measures
@@ -75,4 +76,4 @@ class LpLoss(LossInterface):
loss = torch.linalg.norm((input - target), ord=self.p, dim=-1)
if self.relative:
loss = loss / torch.linalg.norm(input, ord=self.p, dim=-1)
return self._reduction(loss)
return self._reduction(loss)