Files
PINA/pina/loss/weighting_interface.py
2025-09-08 14:46:33 +02:00

35 lines
790 B
Python

"""Module for the Weighting Interface."""
from abc import ABCMeta, abstractmethod
class WeightingInterface(metaclass=ABCMeta):
"""
Abstract base class for all loss weighting schemas. All weighting schemas
should inherit from this class.
"""
def __init__(self):
"""
Initialization of the :class:`WeightingInterface` class.
"""
self._solver = None
@abstractmethod
def aggregate(self, losses):
"""
Aggregate the losses.
:param dict losses: The dictionary of losses.
"""
@property
def solver(self):
"""
The solver employing this weighting schema.
:return: The solver.
:rtype: :class:`~pina.solver.SolverInterface`
"""
return self._solver