Skip to content

Commit 922592b

Browse files
committed
Fix autogram IWRM example in README.md
1 parent 7f724dd commit 922592b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,12 @@ Jacobian descent using [UPGrad](https://torchjd.org/stable/docs/aggregation/upgr
140140
+ engine = Engine(model.modules())
141141

142142
inputs = torch.randn(8, 16, 10) # 8 batches of 16 random input vectors of length 10
143-
targets = torch.randn(8, 16, 1) # 8 batches of 16 targets for the first task
143+
targets = torch.randn(8, 16) # 8 batches of 16 targets for the first task
144144

145145
for input, target in zip(inputs, targets):
146-
output = model(input)
147-
- loss = loss_fn(output, target)
148-
+ losses = loss_fn(output, target)
146+
output = model(input).squeeze(dim=1) # shape [16]
147+
- loss = loss_fn(output, target) # shape [1]
148+
+ losses = loss_fn(output, target) # shape [16]
149149

150150
optimizer.zero_grad()
151151
- loss.backward()

0 commit comments

Comments
 (0)