From 7e5a200d95a3aed18c3176af05d59f525ce3a807 Mon Sep 17 00:00:00 2001 From: inikishev <76593873+inikishev@users.noreply.github.com> Date: Wed, 25 Dec 2024 21:14:13 +0300 Subject: [PATCH] closure --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 9800c6e..3b365a7 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,8 @@ Some optimizers require closure, which should look like this: def closure(backward = True): preds = model(inputs) loss = loss_fn(preds, targets) + + # skip this part if you have no gradients and use zeroth order methods, but keep the unused backward argument. if backward: optimizer.zero_grad() loss.backward()