File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212from ._aggregator_bases import GramianWeightedAggregator
1313from ._mean import MeanWeighting
1414from ._utils .pref_vector import pref_vector_to_str_suffix , pref_vector_to_weighting
15- from ._weighting_bases import Weighting
15+ from ._weighting_bases import GramianWeighting
1616
1717SUPPORTED_SCALE_MODE : TypeAlias = Literal ["min" , "median" , "rmse" ]
1818
1919
20- class AlignedMTLWeighting (Weighting [ PSDMatrix ] ):
20+ class AlignedMTLWeighting (GramianWeighting ):
2121 r"""
2222 :class:`~torchjd.aggregation._weighting_bases.Weighting` giving the weights of
2323 :class:`~torchjd.aggregation.AlignedMTL`.
Original file line number Diff line number Diff line change 33from torchjd ._linalg import PSDMatrix
44
55from ._utils .check_dependencies import check_dependencies_are_installed
6- from ._weighting_bases import Weighting
6+ from ._weighting_bases import GramianWeighting
77
88check_dependencies_are_installed (["cvxpy" , "clarabel" ])
99
1818from ._utils .non_differentiable import raise_non_differentiable_error
1919
2020
21- class CAGradWeighting (Weighting [ PSDMatrix ] ):
21+ class CAGradWeighting (GramianWeighting ):
2222 """
2323 :class:`~torchjd.aggregation._weighting_bases.Weighting` giving the weights of
2424 :class:`~torchjd.aggregation.CAGrad`.
Original file line number Diff line number Diff line change 11from torch import Tensor
22
3- from torchjd ._linalg import Matrix
4-
53from ._aggregator_bases import WeightedAggregator
64from ._utils .str import vector_to_str
7- from ._weighting_bases import Weighting
5+ from ._weighting_bases import MatrixWeighting
86
97
10- class ConstantWeighting (Weighting [ Matrix ] ):
8+ class ConstantWeighting (MatrixWeighting ):
119 """
1210 :class:`~torchjd.aggregation._weighting_bases.Weighting` that returns constant, pre-determined
1311 weights.
Original file line number Diff line number Diff line change 77from ._utils .dual_cone import SUPPORTED_SOLVER , project_weights
88from ._utils .non_differentiable import raise_non_differentiable_error
99from ._utils .pref_vector import pref_vector_to_str_suffix , pref_vector_to_weighting
10- from ._weighting_bases import Weighting
10+ from ._weighting_bases import GramianWeighting
1111
1212
13- class DualProjWeighting (Weighting [ PSDMatrix ] ):
13+ class DualProjWeighting (GramianWeighting ):
1414 r"""
1515 :class:`~torchjd.aggregation._weighting_bases.Weighting` giving the weights of
1616 :class:`~torchjd.aggregation.DualProj`.
Original file line number Diff line number Diff line change 1010
1111from ._aggregator_bases import GramianWeightedAggregator
1212from ._utils .non_differentiable import raise_non_differentiable_error
13- from ._weighting_bases import Weighting
13+ from ._weighting_bases import GramianWeighting
1414
1515
16- class GradVacWeighting (Weighting [ PSDMatrix ] , Stateful ):
16+ class GradVacWeighting (GramianWeighting , Stateful ):
1717 r"""
1818 :class:`~torchjd.aggregation._mixins.Stateful`
1919 :class:`~torchjd.aggregation._weighting_bases.Weighting` giving the weights of
Original file line number Diff line number Diff line change 55
66from ._aggregator_bases import GramianWeightedAggregator
77from ._utils .non_differentiable import raise_non_differentiable_error
8- from ._weighting_bases import Weighting
8+ from ._weighting_bases import GramianWeighting
99
1010
11- class IMTLGWeighting (Weighting [ PSDMatrix ] ):
11+ class IMTLGWeighting (GramianWeighting ):
1212 """
1313 :class:`~torchjd.aggregation._weighting_bases.Weighting` giving the weights of
1414 :class:`~torchjd.aggregation.IMTLG`.
Original file line number Diff line number Diff line change 55from torchjd ._linalg import PSDMatrix
66
77from ._aggregator_bases import GramianWeightedAggregator
8- from ._weighting_bases import Weighting
8+ from ._weighting_bases import GramianWeighting
99
1010
11- class KrumWeighting (Weighting [ PSDMatrix ] ):
11+ class KrumWeighting (GramianWeighting ):
1212 """
1313 :class:`~torchjd.aggregation._weighting_bases.Weighting` giving the weights of
1414 :class:`~torchjd.aggregation.Krum`.
Original file line number Diff line number Diff line change 11import torch
22from torch import Tensor
33
4- from torchjd ._linalg import Matrix
5-
64from ._aggregator_bases import WeightedAggregator
7- from ._weighting_bases import Weighting
5+ from ._weighting_bases import MatrixWeighting
86
97
10- class MeanWeighting (Weighting [ Matrix ] ):
8+ class MeanWeighting (MatrixWeighting ):
119 r"""
1210 :class:`~torchjd.aggregation._weighting_bases.Weighting` that gives the weights
1311 :math:`\begin{bmatrix} \frac{1}{m} & \dots & \frac{1}{m} \end{bmatrix}^T \in
Original file line number Diff line number Diff line change 44from torchjd ._linalg import PSDMatrix
55
66from ._aggregator_bases import GramianWeightedAggregator
7- from ._weighting_bases import Weighting
7+ from ._weighting_bases import GramianWeighting
88
99
10- class MGDAWeighting (Weighting [ PSDMatrix ] ):
10+ class MGDAWeighting (GramianWeighting ):
1111 r"""
1212 :class:`~torchjd.aggregation._weighting_bases.Weighting` giving the weights of
1313 :class:`~torchjd.aggregation.MGDA`.
Original file line number Diff line number Diff line change 11# Partly adapted from https://github.com/AvivNavon/nash-mtl — MIT License, Copyright (c) 2022 Aviv Navon.
22# See NOTICES for the full license text.
33
4- from torchjd ._linalg import Matrix
54from torchjd .aggregation ._mixins import Stateful
65
76from ._utils .check_dependencies import check_dependencies_are_installed
8- from ._weighting_bases import Weighting
7+ from ._weighting_bases import MatrixWeighting
98
109check_dependencies_are_installed (["cvxpy" , "ecos" ])
1110
2120from ._utils .non_differentiable import raise_non_differentiable_error
2221
2322
24- class _NashMTLWeighting (Weighting [ Matrix ] , Stateful ):
23+ class _NashMTLWeighting (MatrixWeighting , Stateful ):
2524 """
2625 :class:`~torchjd.aggregation._mixins.Stateful` :class:`~torchjd.aggregation.Weighting` that
2726 extracts weights using the step decision of Algorithm 1 of `Multi-Task Learning as a Bargaining
You can’t perform that action at this time.
0 commit comments