Skip to content

Commit

Permalink
docs: clarify closure usage in gan example (#8521)
Browse files Browse the repository at this point in the history
* clarify closure usage in gan example

* Update docs/source/common/optimizers.rst

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* remove empty line

* Update docs/source/common/optimizers.rst

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>

* do not capitalize if not a sentence

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>
  • Loading branch information
3 people authored Jul 26, 2021
1 parent 1a59db9 commit c519fce
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions docs/source/common/optimizers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ For example, here step optimizer A every batch and optimizer B every 2 batches.
# update discriminator every 2 steps
if optimizer_idx == 1:
if (batch_idx + 1) % 2 == 0:
# the closure (which includes the `training_step`) won't run if the line below isn't executed
optimizer.step(closure=optimizer_closure)

# ...
Expand Down

0 comments on commit c519fce

Please sign in to comment.