Skip to content

Commit

Permalink
chore(docs): add usage in supervised_training_steps (#1661)
Browse files Browse the repository at this point in the history
* chore(docs): add examples in supervised_training_steps

* fix: add import from
  • Loading branch information
Jeff Yang authored Feb 22, 2021
1 parent 0ea6de5 commit 442bd08
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions ignite/engine/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,17 @@ def supervised_training_step(
Returns:
Callable: update function.
Example::
from ignite.engine import Engine, supervised_training_step
model = ...
optimizer = ...
loss_fn = ...
update_fn = supervised_training_step(model, optimizer, loss_fn, 'cuda')
trainer = Engine(update_fn)
.. versionadded:: 0.5.0
"""

Expand Down Expand Up @@ -115,6 +126,18 @@ def supervised_training_step_amp(
Returns:
Callable: update function
Example::
from ignite.engine import Engine, supervised_training_step_amp
model = ...
optimizer = ...
loss_fn = ...
scaler = torch.cuda.amp.GradScaler(2**10)
update_fn = supervised_training_step_amp(model, optimizer, loss_fn, 'cuda', scaler=scaler)
trainer = Engine(update_fn)
.. versionadded:: 0.5.0
"""

Expand Down Expand Up @@ -170,6 +193,17 @@ def supervised_training_step_apex(
Returns:
Callable: update function.
Example::
from ignite.engine import Engine, supervised_training_step_apex
model = ...
optimizer = ...
loss_fn = ...
update_fn = supervised_training_step_apex(model, optimizer, loss_fn, 'cuda')
trainer = Engine(update_fn)
.. versionadded:: 0.5.0
"""

Expand Down Expand Up @@ -220,6 +254,17 @@ def supervised_training_step_tpu(
Returns:
Callable: update function.
Example::
from ignite.engine import Engine, supervised_training_step_tpu
model = ...
optimizer = ...
loss_fn = ...
update_fn = supervised_training_step_tpu(model, optimizer, loss_fn, 'xla')
trainer = Engine(update_fn)
.. versionadded:: 0.5.0
"""
try:
Expand Down

0 comments on commit 442bd08

Please sign in to comment.