Skip to content

Commit 0afa324

Browse files
Apply suggestions from code review
Co-authored-by: Valérian Rey <31951177+ValerianRey@users.noreply.github.com>
1 parent cf0439c commit 0afa324

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

‎src/torchjd/_linalg/_dual_cone.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
class DualConeProjector(ABC):
1313
"""
1414
Abstract class whose instances are responsible for projecting vectors onto the dual cone of the
15-
rows of a matrix, or rather the dual form of this problem. The current default
16-
:class:`~torchjd.linalg.DualConeProjector` is :class:`~torchjd.linalg.QuadprogProjector`.
15+
rows of a matrix, or rather the dual form of this problem.
1716
"""
1817

1918
@abstractmethod
2019
def __call__(self, U: Tensor, G: PSDMatrix) -> Tensor:
2120
r"""
22-
Computes the weights :math:`w` of the projection of :math:`J^\top u` onto the dual cone of
21+
Computes for each vector :math:`u` in the provided tensor ``U``
22+
the weights :math:`w` of the projection of :math:`J^\top u` onto the dual cone of
2323
the rows of :math:`J`, provided :math:`G = J J^\top` and :math:`u`. In other words, this
2424
computes the :math:`w` that satisfies :math:`\pi_J(J^\top u) = J^\top w`, with
2525
:math:`\pi_J` defined in Equation 3 of [1].
@@ -38,7 +38,7 @@ def __call__(self, U: Tensor, G: PSDMatrix) -> Tensor:
3838
:param U: The tensor of weights corresponding to the vectors to project, of shape
3939
``[..., m]``.
4040
:param G: The Gramian matrix of shape ``[m, m]``. It must be symmetric and positive
41-
definite.
41+
semi-definite.
4242
:return: A tensor of projection weights with the same shape as ``U``.
4343
"""
4444

‎src/torchjd/aggregation/_dualproj.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class DualProjWeighting(_NonDifferentiable, _GramianWeighting):
1818
1919
:param pref_vector: The preference vector to use. If not provided, defaults to
2020
:math:`\begin{bmatrix} \frac{1}{m} & \dots & \frac{1}{m} \end{bmatrix}^T \in \mathbb{R}^m`.
21-
:param projector: The :class:`~torchjd.linalg.DualConeProjector` used tocompute the projection.
21+
:param projector: The :class:`~torchjd.linalg.DualConeProjector` used to compute the projection.
2222
"""
2323

2424
def __init__(
@@ -62,7 +62,7 @@ class DualProj(_NonDifferentiable, GramianWeightedAggregator):
6262
6363
:param pref_vector: The preference vector used to combine the rows. If not provided, defaults to
6464
:math:`\begin{bmatrix} \frac{1}{m} & \dots & \frac{1}{m} \end{bmatrix}^T \in \mathbb{R}^m`.
65-
:param projector: The :class:`~torchjd.linalg.DualConeProjector` used tocompute the projection.
65+
:param projector: The :class:`~torchjd.linalg.DualConeProjector` used to compute the projection.
6666
"""
6767

6868
gramian_weighting: DualProjWeighting

‎src/torchjd/aggregation/_upgrad.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class UPGradWeighting(_NonDifferentiable, _GramianWeighting):
1919
2020
:param pref_vector: The preference vector to use. If not provided, defaults to
2121
:math:`\begin{bmatrix} \frac{1}{m} & \dots & \frac{1}{m} \end{bmatrix}^T \in \mathbb{R}^m`.
22-
:param projector: The :class:`~torchjd.linalg.DualConeProjector` used tocompute the projection.
22+
:param projector: The :class:`~torchjd.linalg.DualConeProjector` used to compute the projection.
2323
"""
2424

2525
def __init__(
@@ -63,7 +63,7 @@ class UPGrad(_NonDifferentiable, GramianWeightedAggregator):
6363
:param pref_vector: The preference vector used to combine the projected rows. If not provided,
6464
defaults to :math:`\begin{bmatrix} \frac{1}{m} & \dots & \frac{1}{m} \end{bmatrix}^T \in
6565
\mathbb{R}^m`.
66-
:param projector: The :class:`~torchjd.linalg.DualConeProjector` used tocompute the projection.
66+
:param projector: The :class:`~torchjd.linalg.DualConeProjector` used to compute the projection.
6767
"""
6868

6969
gramian_weighting: UPGradWeighting

0 commit comments

Comments
 (0)