Skip to content

Commit

Permalink
docs: fix wrong name for example neural net (#2959)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssun-g committed Aug 31, 2022
1 parent ef67576 commit 37beaf8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions docs/source/frameworks/pytorch.rst
Expand Up @@ -21,7 +21,8 @@ For common PyTorch models with single input:

.. code-block:: python
:caption: `train.py`
import bentoml
import torch
import torch.nn as nn
import torch.nn.functional as F
Expand Down Expand Up @@ -74,7 +75,7 @@ For common PyTorch models with single input:
import torch.optim as optim
criterion = nn.CrossEntropyLoss()
optimizer = optim.SGD(net.parameters(), lr=0.001, momentum=0.9)
optimizer = optim.SGD(model.parameters(), lr=0.001, momentum=0.9)
for epoch in range(2): # a small epoch just for demostration purpose
for i, data in enumerate(trainloader, 0):
Expand All @@ -85,7 +86,7 @@ For common PyTorch models with single input:
optimizer.zero_grad()
# forward + backward + optimize
outputs = net(inputs)
outputs = model(inputs)
loss = criterion(outputs, labels)
loss.backward()
optimizer.step()
Expand Down

0 comments on commit 37beaf8

Please sign in to comment.