Skip to content

Commit 30db018

Browse files
chore: Bump ruff-pre-commit from v0.16.0 to 0.16.5 (#774)
* Update formatting slightly -------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Valérian Rey <valerian.rey@gmail.com>
1 parent 230f901 commit 30db018

4 files changed

Lines changed: 13 additions & 12 deletions

File tree

‎.pre-commit-config.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ repos:
1010
- id: check-merge-conflict # Check for files that contain merge conflict strings.
1111

1212
- repo: https://github.com/astral-sh/ruff-pre-commit
13-
rev: v0.16.0
13+
rev: v0.16.5
1414
hooks:
1515
- id: ruff-check
1616
args: [ --fix, --ignore, FIX ] # Allow committing with TODOs. Only CI checks should prevent merging with TODOs.

‎CHANGELOG.md‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,18 @@ changelog does not include internal changes that do not affect the user.
117117
```python
118118
# Before
119119
from torchjd.aggregation import Flattening, UPGradWeighting
120+
120121
weighting = Flattening(UPGradWeighting())
121122
gramian = engine.compute_gramian(losses) # shape: [m1, m2, m2, m1]
122-
weights = weighting(gramian) # shape: [m1, m2]
123+
weights = weighting(gramian) # shape: [m1, m2]
123124
losses.backward(weights)
124125

125126
# After
126127
from torchjd.aggregation import UPGradWeighting
128+
127129
weighting = UPGradWeighting()
128-
gramian = engine.compute_gramian(losses) # shape: [m1 * m2, m1 * m2]
129-
weights = weighting(gramian).reshape(losses.shape) # shape: [m1, m2]
130+
gramian = engine.compute_gramian(losses) # shape: [m1 * m2, m1 * m2]
131+
weights = weighting(gramian).reshape(losses.shape) # shape: [m1, m2]
130132
losses.backward(weights)
131133
```
132134

@@ -140,11 +142,13 @@ changelog does not include internal changes that do not affect the user.
140142
```python
141143
# Before
142144
from torchjd.aggregation import UPGrad
145+
143146
aggregator = UPGrad(norm_eps=1e-6, reg_eps=1e-6, solver="quadprog")
144147

145148
# After
146149
from torchjd.aggregation import UPGrad
147150
from torchjd.linalg import QuadprogProjector
151+
148152
aggregator = UPGrad(projector=QuadprogProjector(norm_eps=1e-6, reg_eps=1e-6))
149153
```
150154
If you used the default `norm_eps`, `reg_eps` and `solver`, you don't have to change anything and

‎CONTRIBUTING.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,13 @@ device and dtype, you have to use the partial functions defined in `tests/utils/
174174
instantiate tensors. For instance, instead of
175175
```python
176176
import torch
177+
177178
a = torch.ones(3, 4)
178179
```
179180
use
180181
```python
181182
from utils.tensors import ones_
183+
182184
a = ones_(3, 4)
183185
```
184186

‎skills/implement-method/references/aggregators.md‎

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,11 @@ allows safe mutation after construction and gives immediate, clear error message
119119
def alpha(self) -> float:
120120
return self._alpha
121121

122+
122123
@alpha.setter
123124
def alpha(self, value: float) -> None:
124125
if not (0.0 <= value <= 1.0):
125-
raise ValueError(
126-
f"Attribute `alpha` must be in [0, 1]. Found alpha={value!r}."
127-
)
126+
raise ValueError(f"Attribute `alpha` must be in [0, 1]. Found alpha={value!r}.")
128127
self._alpha = value
129128
```
130129

@@ -164,11 +163,7 @@ already defines `__str__` to return just the class name, and `Weighting` inherit
164163

165164
```python
166165
def __repr__(self) -> str:
167-
return (
168-
f"{self.__class__.__name__}("
169-
f"alpha={self.alpha!r}, "
170-
f"rho={self.rho!r})"
171-
)
166+
return f"{self.__class__.__name__}(alpha={self.alpha!r}, rho={self.rho!r})"
172167
```
173168

174169
---

0 commit comments

Comments
 (0)