Skip to content

Commit f421254

Browse files
committed
[skip ci] docs: simple usage
1 parent 00236fe commit f421254

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,23 @@ Bunch of optimizer implementations in PyTorch with clean-code, strict types. Hig
1212
$ pip3 install pytorch-optimizer
1313
```
1414

15+
### Simple Usage
16+
17+
```
18+
from pytorch_optimizer import Ranger21
19+
20+
...
21+
model = YourModel()
22+
optimizer = Ranger21(model.parameters())
23+
...
24+
25+
for input, output in data:
26+
optimizer.zero_grad()
27+
loss = loss_function(output, model(input))
28+
loss.backward()
29+
optimizer.step()
30+
```
31+
1532
## Supported Optimizers
1633

1734
| Optimizer | Description | Official Code | Paper |

0 commit comments

Comments
 (0)