Skip to content

Commit 9a2a0ec

Browse files
committed
Improve docstring of AccumulateJac and AccumulateGrad
1 parent 28cf701 commit 9a2a0ec

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/torchjd/autojac/_transform/_accumulate.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ class AccumulateGrad(Transform):
99
"""
1010
Transform from Gradients to {} that accumulates gradients with respect to keys into their
1111
``grad`` field.
12+
13+
The Gradients are not cloned and may be modified in-place by subsequent accumulations, so they
14+
should not be used elsewhere.
1215
"""
1316

1417
def __call__(self, gradients: TensorDict) -> TensorDict:
@@ -23,6 +26,9 @@ class AccumulateJac(Transform):
2326
"""
2427
Transform from Jacobians to {} that accumulates jacobians with respect to keys into their
2528
``jac`` field.
29+
30+
The Jacobians are not cloned and may be modified in-place by subsequent accumulations, so they
31+
should not be used elsewhere.
2632
"""
2733

2834
def __call__(self, jacobians: TensorDict) -> TensorDict:

0 commit comments

Comments
 (0)