Skip to content

Commit 4d31882

Browse files
authored
fix: Unchecked exception in NashMTL (#405)
1 parent 5ad023b commit 4d31882

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/torchjd/aggregation/_nash_mtl.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
import cvxpy as cp
3434
import numpy as np
3535
import torch
36-
from cvxpy import Expression
36+
from cvxpy import Expression, SolverError
3737
from torch import Tensor
3838

3939
from ._aggregator_bases import WeightedAggregator
@@ -170,8 +170,8 @@ def _solve_optimization(self, gtg: np.ndarray) -> np.ndarray:
170170

171171
try:
172172
self.prob.solve(solver=cp.ECOS, warm_start=True, max_iters=100)
173-
except Exception:
174-
# On macOS, this can happen with a cvxpy.error.SolverError: Solver 'ECOS' failed.
173+
except SolverError:
174+
# On macOS, this can happen with: Solver 'ECOS' failed.
175175
# No idea why. The corresponding matrix is of shape [9, 11] with rank 5.
176176
# Maybe other exceptions can happen in other cases.
177177
self.alpha_param.value = self.prvs_alpha_param.value

0 commit comments

Comments
 (0)